Package org.jcsp.lang

Class SharedChannelInputIntImpl

java.lang.Object
org.jcsp.lang.SharedChannelInputIntImpl
All Implemented Interfaces:
ChannelInputInt, Poisonable, SharedChannelInputInt

class SharedChannelInputIntImpl extends Object implements SharedChannelInputInt
  • Field Details

  • Constructor Details

    • SharedChannelInputIntImpl

      SharedChannelInputIntImpl(ChannelInternalsInt _channel, int _immunity)
  • Method Details

    • endRead

      public void endRead()
      Description copied from interface: ChannelInputInt
      End an extended rendezvous. It must be invoked once (and only once) following a startRead.
      Specified by:
      endRead in interface ChannelInputInt
    • read

      public int read()
      Description copied from interface: ChannelInputInt
      Read an int from the channel.
      Specified by:
      read in interface ChannelInputInt
      Returns:
      the integer read from the channel
    • startRead

      public int startRead()
      Description copied from interface: ChannelInputInt
      Begin 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 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 endRead at some point after this function, otherwise the writer will not be freed and deadlock will probably follow.

      The reader process may perform any actions between calling startRead and endRead, including communications on other channels. Further communications on this channel, of course, should not be made.

      An extended rendezvous may be started after the channel's Guard has been selected by an Alternative (i.e. startRead instead of read).

      Specified by:
      startRead in interface ChannelInputInt
      Returns:
      The object read from the channel
    • poison

      public void poison(int strength)
      Description copied from interface: Poisonable
      This 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:
      poison in interface Poisonable
      Parameters:
      strength - the strength of the poison (must be >= 0).