JanetDocsPlaygroundI'm feeling luckyGitHub sign in
# channels that can be used for communication between os threads (def chan-a (ev/thread-chan 10)) (def chan-b (ev/thread-chan 10)) # one thread (ev/thread (fiber/new (fn [] (def msg "hi") (print "thread 1 sending: " msg) (ev/give chan-a msg) # (print "thread 1 received: " (ev/take chan-b)))) :1 :n) # another thread (ev/thread (fiber/new (fn [] (print "thread 2 received: " (ev/take chan-a)) # (def msg "peace") (print "thread 2 sending: " msg) (ev/give chan-b msg))) :2 :n) # expected output # # thread 1 sending: hi # thread 2 received: hi # thread 2 sending: peace # thread 1 received: peace