Sending and receiving messages
word sends a message asynchronously, and the sending thread continues immediately. It is also possible to send a message to a thread and block until a response is received:
( message thread -- reply )
To reply to a synchronous message:
( message synchronous -- )
( quot: ( ... message -- ... reply ) -- )
USING: concurrency.messaging kernel threads ; IN: scratchpad : pong-server ( -- ) [ drop "pong" ] handle-synchronous ; [ pong-server t ] "pong-server" spawn-server "ping" swap send-synchronous .