Package org.jcsp.lang
Class SharedChannelInputIntImpl
- java.lang.Object
-
- org.jcsp.lang.SharedChannelInputIntImpl
-
- All Implemented Interfaces:
ChannelInputInt,Poisonable,SharedChannelInputInt
class SharedChannelInputIntImpl extends java.lang.Object implements SharedChannelInputInt
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelInternalsIntchannelprivate intimmunity
-
Constructor Summary
Constructors Constructor Description SharedChannelInputIntImpl(ChannelInternalsInt _channel, int _immunity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendRead()End an extended rendezvous.voidpoison(int strength)This injects poison into the channel.intread()Read an int from the channel.intstartRead()Begin an extended rendezvous read from the channel.
-
-
-
Field Detail
-
channel
private ChannelInternalsInt channel
-
immunity
private int immunity
-
-
Constructor Detail
-
SharedChannelInputIntImpl
SharedChannelInputIntImpl(ChannelInternalsInt _channel, int _immunity)
-
-
Method Detail
-
endRead
public void endRead()
Description copied from interface:ChannelInputIntEnd an extended rendezvous. It must be invoked once (and only once) following a.startRead- Specified by:
endReadin interfaceChannelInputInt
-
read
public int read()
Description copied from interface:ChannelInputIntRead an int from the channel.- Specified by:
readin interfaceChannelInputInt- Returns:
- the integer read from the channel
-
startRead
public int startRead()
Description copied from interface:ChannelInputIntBegin an extended rendezvous read from the channel. An extended rendezvous is not completed until the reader has completed its extended action. This method starts an extended rendezvous. When a writer to this channel writes, this method returns what was sent immediately. The extended rendezvous continues with reader actions until the reader invokes. Only then will the writer be released (from itsendReadmethod). The writer is unaware of the extended nature of the communication.writeThe reader process must call
at some point after this function, otherwise the writer will not be freed and deadlock will probably follow.endReadThe reader process may perform any actions between calling
andstartRead, including communications on other channels. Further communications on this channel, of course, should not be made.endReadAn extended rendezvous may be started after the channel's Guard has been selected by an
Alternative(i.e.instead ofstartRead).read- Specified by:
startReadin interfaceChannelInputInt- Returns:
- The object read from the channel
-
poison
public void poison(int strength)
Description copied from interface:PoisonableThis injects poison into the channel. If the channel was not explicitly constructed to be poisonable or if the strength of poison is not greater than the channel immunity level, the poison will have no effect.- Specified by:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
-