macro
boot.janet on line 3566, column 3
(ev/do-thread & body)
Run some code in a new thread. Suspends the current fiber until the
thread is complete, and evaluates to nil.
# channel that can be used for communication between os threads
(def chan (ev/thread-chan 10))
# one thread for sending a message
(ev/do-thread
(def msg "hi")
(print "sending: " msg)
(ev/give chan msg))
# another thread for receiving a message
(ev/do-thread
(print "received: " (ev/take chan)))
# expected output
#
# sending: hi
# received: hi