Sam Phillips <samdphillips@gmail.com>
The syncvar library is a library to access synchronous variables inspired by CML.
This library primarily provides Id style synchronous variables. These variables have two states: empty and full. When a thread attempts to read a variable that is empty the thread will block until it is full. Any attempt to write a value to a full variable will raise an exception.
An ivar is a write once synchronous variable. Once an ivar is in the full state it cannot go back to the empty state.
In addition to its use with ivar-specific procedures, an ivar can be used as a synchronizable event. An ivar is ready for synchronization when ivar-get would not block; the synchronization result is the same as the ivar-get result.
procedure
( ivar-try-get an-ivar)→any
an-ivar:ivar?
procedure
( ivar-get-evt an-ivar)→evt?
an-ivar:ivar?
procedure
( exn:fail:ivar? v)→boolean?
v:any/c
A mvar is a mutable synchronous variable.
procedure
( mvar-take! a-mvar)→any
a-mvar:mvar?
procedure
( mvar-try-take! a-mvar)→any
a-mvar:mvar?
procedure
( mvar-try-get a-mvar)→any
a-mvar:mvar?
procedure
( mvar-swap! a-mvarv)→any
a-mvar:mvar?v:any/c
If an error occurs while running f, then the original value will be stored in a-mvar.
Changed in version 0.9.3 of package syncvar-lib: fixed update error behavior
procedure
( mvar-take!-evt a-mvar)→evt?
a-mvar:mvar?
When this event is ready the stored value will be removed.
procedure
( mvar-get-evt a-mvar)→evt?
a-mvar:mvar?
procedure
( mvar-swap!-evt a-mvarv)→evt?
a-mvar:mvar?v:any/c
When this event is ready the value stored in a-mvar will be replaced with the value v.
When this event is ready the value stored in a-mvar will be replaced with a the value returned from applying f to the old value.
If an error occurs while running f, then the original value will be stored in a-mvar.
Changed in version 0.9.3 of package syncvar-lib: fixed update error behavior
procedure
( exn:fail:mvar? v)→boolean?
v:any/c
Fix behavior in mvar-update!-evt when running the update function resulted in an error.
Fixed bug in mvar-update!-evt where the previous value was not returned.
Bumping version number to be valid.
Initial package server release.