job recv
for experimental
Signature
> job recv {flags}
Flags
--tag {int}
: A tag for the message--timeout {duration}
: The maximum time duration to wait for.
Input/output types:
input | output |
---|---|
nothing | any |
Examples
Block the current thread while no message arrives
> job recv
Receive a message, wait for at most 10 seconds.
> job recv --timeout 10sec
Get a message or fail if no message is available immediately
> job recv --timeout 0sec
Notes
When messages are sent to the current process, they get stored in what is called the "mailbox". This commands reads and returns a message from the mailbox, in a first-in-first-out fashion. j Messages may have numeric flags attached to them. This commands supports filtering out messages that do not satisfy a given tag, by using the tag
flag. If no tag is specified, this command will accept any message.
If no message with the specified tag (if any) is available in the mailbox, this command will block the current thread until one arrives. By default this command block indefinitely until a matching message arrives, but a timeout duration can be specified. If a timeout duration of zero is specified, it will succeed only if there already is a message in the mailbox.
Note: When using par-each, only one thread at a time can utilize this command. In the case of two or more threads running this command, they will wait until other threads are done using it, in no particular order, regardless of the specified timeout parameter.