Is there a way to wait for a thread to end, other than something like
(let th (thread (sleep 1)) (until (dead th)) (pr 'done))
(= pid 0) (def test () (let parent? (fork) (= pid (+ (* pid 2) (if parent? 0 1))))) (thread (test) (test) (test) (prn pid))
(= foo (thread-local)) (foo) ; read the variable (= (foo) 42) ; write the variable
(let s (sema) ; thread you're waiting on (thread (sleep 1) (sema-post s)) ; monitoring thread (sync s) (pr 'done))
-----
(let th ; thread you're waiting on (thread (sleep 1)) ; monitoring thread (sync th) (pr 'done))
(w/uniq void (mac w/thread-local (var (o val void)) (if (is val void) `(= ,var (thread-local)) `(do (= ,var (thread-local)) (= (,var) ,val)))))
(w/thread-local foo 0)
(= foo (thread-local)) (= (foo) 0)