Next: Rendezvous communication channels, Previous: Rendezvous concepts, Up: Concurrent ML
The rendezvous
structure exports several basic rendezvous
combinators.
A rendezvous that is never enabled. If synchronized, this will block the synchronizing thread indefinitely.
Returns a rendezvous that is always enabled with the given value. This rendezvous will never block the synchronizing thread.
Guard
returns a delayed rendezvous, generated by the given procedure rv-generator, which is passed zero arguments whenever the resultant rendezvous is synchronized.With-nack
returns a delayed rendezvous for which a negative acknowledgement rendezvous is constructed. If the resultant rendezvous is synchronized as a part of a composite rendezvous, the procedurerv-generator
is passed a nack for the synchronization, and it returns the rendezvous to actually synchronize. If the delayed rendezvous was synchronized as part of a composite group of rendezvous, and another rendezvous among that group is enabled and chosen first, the nack is enabled.
Returns a rendezvous that, when synchronized, synchronizes all of the given components, and chooses only the first one to become enabled, or the highest priority one if there are any that are already enabled. If any of the rendezvous that were not chosen when the composite became enabled were delayed rendezvous with nacks, their nacks are enabled.
Returns a rendezvous equivalent to rendezvous but wrapped with procedure, so that, when the resultant rendezvous is synchronized, rendezvous is transitively synchronized, and when rendezvous is enabled, the resultant rendezvous is also enabled, with the value that procedure returns when passed the value produced by rendezvous.
(sync (wrap (always-rv 4) (lambda (x) (* x x)))) --> 16
Sync
andselect
synchronize rendezvous.Sync
synchronizes a single one;select
synchronizes any from the given set of them.Select
is equivalent to(sync (apply choose
rendezvous ...))
, but it may be implemented more efficiently.
The rendezvous-time
structure exports two constructors for
rendezvous that become enabled only at a specific time or after a delay
in time.
At-real-time-rv
returns a rendezvous that becomes enabled at the time milliseconds relative to the start of the Scheme program.After-time-rv
returns a rendezvous that becomes enabled at least milliseconds after synchronization (not construction).