Concurrent.Channel
Definitions
@LoweringTarget def get(c: Mpmc[a, Static]): a \ IO
SourceRetrieves an element from the channel c. This is blocking if the
channel is empty.
Implements to the expression <- c.
@LoweringTarget def newChannel(bufferSize: Int32): Mpmc[a, Static] \ IO
SourceCreates a new channel. A runtime error occurs if bufferSize is
negative. A channel with bufferSize zero means that sending and
receiving is syncronized.
@LoweringTarget def newChannelTuple(bufferSize: Int32): (Mpmc[a, Static], Mpmc[a, Static]) \ IO
SourceCreates a new channel tuple (sender, receiver)
@LoweringTarget def put(e: a, c: Mpmc[a, Static]): Unit \ IO
SourceSends the element e on the channel c. This is blocking if the
channel is full or unbuffered.
Implements the expression c <- e.
@LoweringTarget def selectFrom(channels: List[MpmcAdmin], blocking: Bool): (Int32, List[ReentrantLock]) \ IO
SourceReturns the index of the first channel that has an element in the array
along with a set of locks to be unlocked after retrieval.
Returns (-1, _) if no channels have elements and blocking == false,
otherwise this blocks.
OBS: In the blocking case, caller Must call unlockLocks on the
returned list of locks post call.
In the non-blocking case, selectFrom unlocks all locks first
@LoweringTarget def unsafeGetAndUnlock(c: Mpmc[a, Static], locks: List[ReentrantLock]): a \ IO
SourceRetrieves an element from the channel c and unlocks locks after doing so.
Assumes the channel to be non-empty.