receive-if ( pred -- message )
Message-passing concurrency ยป Sending and receiving messages

Prev:receive-timeout ( timeout -- message )
Next:receive-if-timeout ( timeout pred -- message )


Vocabulary
concurrency.messaging

Inputs
preda predicate with stack effect ( obj -- ? )


Outputs
messagean object


Word description
Return the first message from the current thread's mailbox that satisfies the predicate. To satisfy the predicate, pred is called with the item on the stack and the predicate should leave a boolean indicating whether it was satisfied or not. If nothing in the mailbox satisfies the predicate then the thread will block until something does.

See also
send, receive

Definition