package channel
Specifies primitive (non-alternation-capable) ports and channels; and implements several channel types.
- Alphabetic
- By Inheritance
- channel
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type ![-T] = OutPort[T]
- type ?[+T] = InPort[T]
- trait Chan [T] extends InPort[T] with OutPort[T] with Named[Chan[T]] with debug.REGISTRY.Debuggable
-
class
Closed
extends Stopped
Thrown by an attempt to read from or write to a port that is already closed (or that closes before the termination of the read/write).
-
trait
InPort
[+T] extends AnyRef
A channel is a sequential conduit for data that is written to its
OutPort
, and subsequently read from itsInPort
.A channel is a sequential conduit for data that is written to its
OutPort
, and subsequently read from itsInPort
.For most normal channels at any instant: the sequence of data that has been read from the channel with
?
is a prefix of the sequence of data written to the channel by!
. Dropping channels may drop data under conditions of congestion: precise behaviours of such channels should be documented with their definitions. -
class
N2N
[T] extends OneOne[T] with SharedChan[T]
Synchronized shared channel to support communication between
writers
writers andreaders
readers.Synchronized shared channel to support communication between
writers
writers andreaders
readers. Closes completely whencloseOut
has been invokedwriters
times, orcloseIn
has been invokedreaders
times. If eitherwriters
orreaders
is non-positive, then the channel can be closed an unbounded number of times in the associated direction.There is no check for writer-overtaking in an
N2N(1,_)
or for reader-overtaking in anN2N(_, 1)
. Both ends of anN2N
behave as if they were shared.The
fairOut
andfairIn
parameters control whether processes are FIFO-queued to use the output/input side of the underlying synchronous channel when there is heavy contention. They both default to false -- for efficiency when there is little contention.- T
type of value transmitted by the buffer
-
class
N2NBuf
[T] extends SharedChan[T]
A general-purpose shared buffered channel, bounded by
size
if it is positive, and unbounded otherwise.A general-purpose shared buffered channel, bounded by
size
if it is positive, and unbounded otherwise.The buffer can be shared by any number of readers and writers.
It closes completely when
closeIn
has been invokedreaders
times, orcloseOut
has been invokedwriters
times and the buffer has been emptied.If either
writers
orreaders
is non-positive, then the channel can be closed an unbounded number of times in the associated direction.There is no attempt to ensure fairness between sharing writers or sharing readers.
- T
type of value transmitted by the buffer
-
class
OneOne
[T] extends SyncChan[T]
A synchronized channel to be used by at most one reader and writer process simultaneously.
A synchronized channel to be used by at most one reader and writer process simultaneously. There are dynamic checks for simultaneous multiple reads (writes), but they are are incomplete. They cannot reliably detect that multiple readers (writers) are running concurrently with a single writer (reader) that is fast enough to keep up with their read (write) rate.
The channel closes when either
orcloseOut()
orcloseIn()
is invoked.close()
- T
the type of message transmitted by the channel
-
class
OneOneBuf
[T] extends N2NBuf[T]
A general-purpose shared buffered channel, bounded by
size
if it is positive, and unbounded otherwise.A general-purpose shared buffered channel, bounded by
size
if it is positive, and unbounded otherwise.The buffer can be shared by any number of readers and writers simultaneously, and (unlike OneOne channel) there is no dynamic check for reader-overtaking (more than a single process trying to read simultaneously) or writer overtaking.
It closes completely after
closeIn
has been invoked, or aftercloseOut
has been invoked and the buffer is empty.- T
type of value transmitted by the buffer
-
trait
OutPort
[-T] extends AnyRef
A channel is a sequential conduit for data that is written to its
OutPort
, and subsequently read from itsInPort
.A channel is a sequential conduit for data that is written to its
OutPort
, and subsequently read from itsInPort
.For most normal channels at any instant: the sequence of data that has been read from the channel with
?
is a prefix of the sequence of data written to the channel by!
. Dropping channels may drop data under conditions of congestion. -
sealed
trait
PortState
extends AnyRef
A type denoting the state of readiness/commitment of a port.
A type denoting the state of readiness/commitment of a port. Used in the implementation of alternations.
-
trait
SharedChan
[T] extends Chan[T] with SharedOutPort[T] with SharedInPort[T]
A channel whose input and output ports may each be shared
-
trait
SharedInPort
[+T] extends InPort[T]
An input port that may be shared among several readers simultaneously.
-
trait
SharedOutPort
[-T] extends OutPort[T]
An output port that may be shared among several writers simultaneously.
-
trait
SyncChan
[T] extends Chan[T]
A channel that is guaranteed to be synchronous
Value Members
-
object
CLOSEDSTATE
extends PortState with Product with Serializable
The port is closed
-
object
N2N
extends NameGenerator
Static generator(s) for shared synchronized channel
Static generator(s) for shared synchronized channel
- See also
-
object
N2NBuf
extends NameGenerator
Static generator for
N2NBuf
Static generator for
N2NBuf
- See also
-
object
OneOne
extends NameGenerator
Static generator for OneOne channel.
Static generator for OneOne channel.
- See also
-
object
OneOneBuf
extends NameGenerator
Static generator for OneOneBuf
Static generator for OneOneBuf
- See also
-
object
READYSTATE
extends PortState with Product with Serializable
The port's channel is in a state that guarantees the next unconditional input (on an
InPort
) or output (on anOutPort
) action on the port can be invoked with no danger of an unbounded wait because:The port's channel is in a state that guarantees the next unconditional input (on an
InPort
) or output (on anOutPort
) action on the port can be invoked with no danger of an unbounded wait because:- In the case of a synchronized channel, a peer has (already) committed to the complementary output/input on the dual port, or
- In the case of a buffer, the buffer is in an appropriate state, viz: nonempty for an
InPort
to be ready, and nonfull for anOutPort
to be ready.
-
object
UNKNOWNSTATE
extends PortState with Product with Serializable
The readiness of the port is unknown