These activities enable asynchronous programming. send()
broadcasts a signal or a list
of signals. Arrivals can subscribe to signals and (optionally) assign a handler with
trap()
. Note that, while inside a batch, all the signals subscribed before entering
the batch are ignored. Upon a signal reception, the arrival stops the current activity and
executes the handler (if provided). Then, the execution returns to the activity following the
point of the interruption. untrap()
can be used to unsubscribe from signals.
wait()
blocks until a signal is received.
send(.trj, signals, delay = 0)trap(.trj, signals, handler = NULL, interruptible = TRUE)
untrap(.trj, signals)
wait(.trj)
the trajectory object.
signal or list of signals, accepts either a string, a list of strings or a callable object (a function) which must return a string or a list of strings.
optional timeout to trigger the signals, accepts either a numeric or a callable object (a function) which must return a numeric.
optional trajectory object to handle a signal received.
whether the handler can be interrupted by signals.
Returns the trajectory object.