flix

0.67.2

Concurrent.Channel

Definitions

@LoweringTarget
def get(c: Mpmc[a, Static]): a \ IO Source

Retrieves an element from the channel c. This is blocking if the channel is empty.

Implements to the expression <- c.

@LoweringTarget
def mpmcAdmin(c: Mpmc[a, Static]): MpmcAdmin Source

Returns the MpmcAdmin of c.

@LoweringTarget
def newChannel(bufferSize: Int32): Mpmc[a, Static] \ IO Source

Creates 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 Source

Creates a new channel tuple (sender, receiver)

@LoweringTarget
def put(e: a, c: Mpmc[a, Static]): Unit \ IO Source

Sends 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 Source

Returns 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 Source

Retrieves an element from the channel c and unlocks locks after doing so. Assumes the channel to be non-empty.