justinethier/cyclone

Allow specifying stack size for pthreads

justinethier opened this issue · 3 comments

Alpine Linux uses a small stack size (128 KB) for pthreads. This is too small to work with Cyclone as we are currently configured to build.

Here is a simple program to demonstrate whether the change works:

(import
  (scheme base)
  (scheme write)
  (srfi 18))

(define (ack m n)
  (cond ((= m 0) (+ n 1))
        ((= n 0) (ack (- m 1) 1))
        (else (ack (- m 1) (ack m (- n 1))))))

(let ((t (thread-start! (make-thread (lambda () (ack 3 10))))))
  (write (thread-join! t))
  (newline))

@nmeum I would expect the above program will crash on Alpine Linux unless Cyclone is compiled to set its own thread stack size, EG:

make CYC_PTHREAD_SET_STACK_SIZE=1
nmeum commented

Yep, can confirm that the program crashes without CYC_PTHREAD_SET_STACK_SIZE=1 and works fine with it. Though I noticed #476 (comment) while testing this.

Well, that's great this change works! Let me close out this ticket and we can discuss the other issue separately.