Next: Channels, Previous: Fibers example, Up: Fibers [Contents][Index]
Operations are first-class abstractions for asynchronous events.
There are primitive operation types, such as waiting for a timer
(see Timers) or waiting for a message on a channel
(see Channels). Operations can also be combined and transformed
using the choice-operation
and wrap-operation
from the
(fibers operations)
module.
Given the operation op, return a new operation that, if and when it succeeds, will apply f to the values yielded by performing op, and yield the result as the values of the wrapped operation.
Given the operations ops, return a new operation that if it succeeds, will succeed with one and only one of the sub-operations ops.
Finally, once you have an operation, you can perform it using
perform-operation
.
Perform the operation op and return the resulting values. If the operation cannot complete directly, block until it can complete.
There is also a low-level constructor for other modules that implement primitive operation types:
Make a fresh base operation.