(= 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)