Mailboxes


A mailbox is a first-in-first-out queue where the operation of removing an element blocks if the queue is empty. Mailboxes are implemented in the concurrency.mailboxes vocabulary.
mailbox

<mailbox> ( -- mailbox )


Removing the first element:
mailbox-get ( mailbox -- obj )

mailbox-get-timeout ( mailbox timeout -- obj )


Removing the first element matching a predicate:
mailbox-get? ( mailbox pred -- obj )

mailbox-get-timeout? ( mailbox timeout pred -- obj )


Emptying out a mailbox:
mailbox-get-all ( mailbox -- array )


Adding an element:
mailbox-put ( obj mailbox -- )


Testing if a mailbox is empty:
mailbox-empty? ( mailbox -- bool )

while-mailbox-empty ( mailbox quot -- )