class AltingChannelOutputSymmetricImpl<T> extends AltingChannelOutput<T> implements MultiwaySynchronisation
Modifier and Type | Field and Description |
---|---|
private AltingBarrier |
ab |
private ChannelOutput<T> |
out |
private boolean |
syncDone |
Constructor and Description |
---|
AltingChannelOutputSymmetricImpl(AltingBarrier ab,
ChannelOutput<T> out) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
disable()
Disables the guard for selection.
|
(package private) boolean |
enable(Alternative alt)
Returns true if the event is ready.
|
boolean |
pending()
Returns whether the receiver is committed to read from this channel.
|
void |
poison(int strength)
This injects poison into the channel.
|
void |
write(T o)
Write an Object to the channel.
|
private final AltingBarrier ab
private final ChannelOutput<T> out
private boolean syncDone
public AltingChannelOutputSymmetricImpl(AltingBarrier ab, ChannelOutput<T> out)
boolean enable(Alternative alt)
Guard
Note: this method should only be called by the Alternative class
boolean disable()
Guard
Note: this method should only be called by the Alternative class
public void write(T o)
ChannelOutput
write
in interface ChannelOutput<T>
o
- the object to write to the channelpublic boolean pending()
AltingChannelOutput
Note: if this returns true, you must commit to write down this channel.
pending
in class AltingChannelOutput<T>
public void poison(int strength)
Poisonable
poison
in interface Poisonable
strength
- the strength of the poison (must be >= 0).