Package org.jcsp.lang

Class AltingBarrierBase

java.lang.Object
org.jcsp.lang.AltingBarrierBase

class AltingBarrierBase extends Object
  • Field Details

    • frontEnds

      private AltingBarrier frontEnds
      All front-ends are chained off here. Each process enrolled must have one, and only one, of these.
    • enrolled

      private int enrolled
      The number of processes enrolled.
    • countdown

      private int countdown
      The number of processes not yet offered to sync on this barrier.
  • Constructor Details

    • AltingBarrierBase

      AltingBarrierBase()
  • Method Details

    • expand

      AltingBarrier[] expand(int n)
    • expand

      AltingBarrier expand()
    • contract

      void contract(AltingBarrier[] ab)
      This removes the given front-ends chained to this alting barrier. It also nulls all of them - to prevent any attempted reuse!

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.

      Parameters:
      ab - the front-ends being discarded from this barrier. This array must be unaltered from one previously delivered by an expand.
    • contract

      void contract(AltingBarrier ab)
      This removes the given front-end chained to this alting barrier. It also nulls its reference to this base - to prevent any attempted reuse!

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.

      Parameters:
      ab - the front-end being discarded from this barrier. This array must be unaltered from one previously delivered by an expand.
    • enable

      boolean enable()
      Record the offer to synchronise.

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.

      Returns:
      true if all the offers are in.
    • disable

      boolean disable()
      Withdraw the offer to synchronise.

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.

      Returns:
      true all the offers are in.
    • resign

      void resign()
      Record resignation.

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.

    • enroll

      void enroll()
      Record re-enrollment.

      Note: this method should only be called by an AltingBarrier synchronised on this AltingBarrierBase.