divide-and-conquer   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/xthread.xtm

Implementation

(bind-func divide-and-conquer
  (lambda (cnt:i32)
    (spawn (lambda ()
             (printf "cnt:%d thread:%p\n" cnt (thread_self))
             (thread_sleep 1 0) ;; sleep for a second
             (if (> cnt 0)
                 (begin (divide-and-conquer (- cnt 1))
                        (divide-and-conquer (- cnt 1))))
             void))
    void))


Back to Index