class AltingChannelInputIntSymmetricImpl extends AltingChannelInputInt implements MultiwaySynchronisation
Modifier and Type | Field and Description |
---|---|
private AltingBarrier |
ab |
private ChannelInputInt |
in |
private boolean |
syncDone |
Constructor and Description |
---|
AltingChannelInputIntSymmetricImpl(AltingBarrier ab,
ChannelInputInt in) |
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.
|
void |
endRead()
End an extended rendezvous.
|
boolean |
pending()
Returns whether there is data pending on this channel.
|
void |
poison(int strength)
This injects poison into the channel.
|
int |
read()
Read an int from the channel.
|
int |
startRead()
Begin an extended rendezvous read from the channel.
|
private final AltingBarrier ab
private final ChannelInputInt in
private boolean syncDone
public AltingChannelInputIntSymmetricImpl(AltingBarrier ab, ChannelInputInt in)
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 int read()
ChannelInputInt
read
in interface ChannelInputInt
public boolean pending()
AltingChannelInputInt
Note: if there is, it won't go away until you read it. But if there isn't, there may be some by the time you check the result of this method.
pending
in class AltingChannelInputInt
public void poison(int strength)
Poisonable
poison
in interface Poisonable
strength
- the strength of the poison (must be >= 0).public void endRead()
ChannelInputInt
startRead
.endRead
in interface ChannelInputInt
public int startRead()
ChannelInputInt
endRead
.
Only then will the writer be released (from its
write
method).
The writer is unaware of the extended nature of the communication.
The reader process must call
at some point after this function, otherwise the writer will not
be freed and deadlock will probably follow.
endRead
The reader process may perform any actions between calling
and
startRead
, including communications
on other channels. Further communications on this channel, of course,
should not be made.
endRead
An extended rendezvous may be started after the channel's Guard
has been selected by an Alternative
(i.e.
instead of
startRead
).read
startRead
in interface ChannelInputInt