1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Work on thread/receive doubling as select.

This commit is contained in:
Calvin Rose
2019-12-04 22:31:01 -06:00
parent fd4220f254
commit e908029392
3 changed files with 65 additions and 16 deletions

View File

@@ -5,7 +5,7 @@
(for i 0 10
(os/sleep interval)
(printf "thread %s wakeup no. %d" name i))
(:send parent :done))
(:send parent name))
(defn make-worker
[name interval]
@@ -19,6 +19,5 @@
(def sam (make-worker "sam" 0.5))
# Receive out of order
(:receive bob)
(:receive sam)
(:receive joe)
(for i 0 3
(print "worker " (thread/receive [bob sam joe]) " finished!"))