JanetDocsPlaygroundI'm feeling luckyGitHub sign in

thread/receive



    cfunction

    (thread/receive &opt timeout)

    Get a message sent to this thread. If timeout (in seconds) is 
    provided, an error will be thrown after the timeout has elapsed but 
    no messages are received. The default timeout is 1 second, and 
    math/inf cam be passed to turn off the timeout.


1 exampleSign in to add an example
Loading...
(defn worker [m]
  (thread/send m "Hello function")
  (:send m "Hello method"))

(thread/new worker)
(pp (thread/receive)) # => prints Hello function
(pp (thread/receive)) # => prints Hello method

pepePlayground