Next: , Previous: , Up: Fibers   [Contents][Index]


4.14.5 Conditions

Condition variables are a simple one-bit form of concurrent communication. A condition variable has two states: it starts in the unsignalled state and later may transition to the signalled state. When a condition becomes signalled, any associated waiting operations complete. The following API can be found in the (fibers conditions) module.

Procedure: make-condition

Make a new condition variable.

Procedure: condition? obj

Return #t if obj is a condition variable, or #f otherwise.

Procedure: signal-condition! cvar

Signal cvar, notifying all waiting fibers and preventing blocking of future fibers waiting on this condition.

Procedure: wait-operation cvar

Make an operation that will succeed with no values when cvar becomes signalled.

Procedure: wait cvar

Block the calling fiber until cvar becomes signalled. Equivalent to (perform-operation (wait-operation cvar)).