class N2N[T] extends OneOne[T] with SharedChan[T]
Synchronized shared channel to support communication between writers
writers and readers
readers. Closes completely when
closeOut
has been invoked writers
times, or
closeIn
has been invoked readers
times. If either writers
or readers
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 an N2N(_, 1)
. Both ends
of an N2N
behave as if they were shared.
The fairOut
and fairIn
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
- Alphabetic
- By Inheritance
- N2N
- SharedChan
- SharedInPort
- SharedOutPort
- OneOne
- SyncChan
- Chan
- Debuggable
- Named
- OutPort
- InPort
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
N2N(writers: Int, readers: Int, name: String, fairOut: Boolean, fairIn: Boolean)
- writers
expected number of writers
- readers
expected number of readers
- name
name of the buffer (for the debugger)
Value Members
-
def
!(value: T): Unit
Output
value
to the port's channel. -
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
?[U](f: (T) ⇒ U): U
Ordinary rendezvous read & sync then compute
-
def
?(): T
Block until a value is available for input, then read and return it.
-
def
??[U](f: (T) ⇒ U): U
Extended rendezvous read & compute, then sync
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
canInput: Boolean
Returns
false
if no further input will be supplied by this port. -
def
canOutput: Boolean
Returns
false
if no further output can be accepted by this port. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
close(): Unit
Signal that the channel is to be closed forthwith
-
def
closeIn(): Unit
Signal that no further attempts will be made to input from the invoking thread: idempotent
-
def
closeOut(): Unit
Signal that no further values will be output from the invoking thread: idempotent
-
def
currentState: String
Capture (an approximation to) the current state for debugger components
Capture (an approximation to) the current state for debugger components
- Definition Classes
- OneOne
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
finishedRW: String
Intelligible information about finished reads and writes
Intelligible information about finished reads and writes
- Definition Classes
- OneOne
- Annotations
- @elidable( FINEST )
-
def
finishedRead: Long
Increment count of finished reads
Increment count of finished reads
- Definition Classes
- OneOne
- Annotations
- @elidable( FINEST )
-
def
finishedWrite: Long
Increment count of finished writes
Increment count of finished writes
- Definition Classes
- OneOne
- Annotations
- @elidable( FINEST )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getWaiting: Seq[Thread]
Return an approximation to the set of threads waiting for this channel.
Return an approximation to the set of threads waiting for this channel. Intended to be invoked (from the debugger) only when system is quiescing or deadlocked.
- Definition Classes
- N2N → Debuggable
-
def
hasState: Boolean
This object has a state worth showing right now: false if showState will do no output.
This object has a state worth showing right now: false if showState will do no output.
- Definition Classes
- Debuggable
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
inPortEvent(portState: PortState): Unit
The channel has just changed its state in a way that will affect
inPortState
The channel has just changed its state in a way that will affect
inPortState
- Definition Classes
- Chan
-
def
inPortState: PortState
READY if not closed and there's a writer waiting to sync (else CLOSED or UNKNOWN) (used only by alternation implementations)
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
key: StateKey
This object's key in the registry (if non-negative)
This object's key in the registry (if non-negative)
- Definition Classes
- Debuggable
-
def
name: String
Return the name of the object
Return the name of the object
- Definition Classes
- Named
-
def
nameGenerator: NameGenerator
Discover the name generator
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
nothing: T
The null value for this port -- equivalent to
null.asInstanceOf[T]
.The null value for this port -- equivalent to
null.asInstanceOf[T]
. Useful to initialise variables that will in due course be assigned values by reading from the port.- Definition Classes
- InPort
- Annotations
- @inline()
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
outPortEvent(portState: PortState): Unit
The channel has just changed its state in a way that will affect
outPortState
The channel has just changed its state in a way that will affect
outPortState
- Definition Classes
- Chan
-
def
outPortState: PortState
READY if not closed and there's a reader waiting and last writer has already synced (else CLOSED or UNKNOWN) (used only by alternation implementations)
-
def
readBefore(nsWait: Long): Option[T]
Block until the earlier of the following events happens:
-
val
reads: AtomicLong
Count of the number of finished reads (writes)
Count of the number of finished reads (writes)
- Definition Classes
- OneOne
-
def
register(): Unit
Register this object
Register this object
- Definition Classes
- Debuggable
-
def
setName(name: String): Unit
Set the name using the name generator
Set the name using the name generator
- Definition Classes
- Named
-
def
showState(out: PrintWriter): Unit
Not thread-safe: best invoked only when system is quiescing (when the debugger is invoked).
Not thread-safe: best invoked only when system is quiescing (when the debugger is invoked).
- Definition Classes
- N2N → OneOne → Debuggable
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toString(): String
-
def
unregister(): Unit
Unregister this object
Unregister this object
- Definition Classes
- Debuggable
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
withDebugger[T](condition: Boolean)(body: ⇒ T): T
Conditionally
register
this object with the debugger only for the duration of the evaluation ofbody
.Conditionally
register
this object with the debugger only for the duration of the evaluation ofbody
. To be used as a last resort for the exasperated CSO toolkit debugger.- Definition Classes
- Debuggable
-
def
withName(__name: String): Chan[T]
Set the name of this object and return it
Set the name of this object and return it
- Definition Classes
- Named
-
def
writeBefore(nsWait: Long)(value: T): Boolean
Output
value
to the port's channel beforensWait
has elapsed, and return true; or return false -
val
writes: AtomicLong
Count of the number of finished reads (writes)
Count of the number of finished reads (writes)
- Definition Classes
- OneOne