Package org.jcsp.lang
Class AltingBarrierBase
java.lang.Object
org.jcsp.lang.AltingBarrierBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe number of processes not yet offered to sync on this barrier.private intThe number of processes enrolled.private AltingBarrierAll front-ends are chained off here. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidThis removes the given front-end chained to this alting barrier.(package private) voidcontract(AltingBarrier[] ab) This removes the given front-ends chained to this alting barrier.(package private) booleandisable()Withdraw the offer to synchronise.(package private) booleanenable()Record the offer to synchronise.(package private) voidenroll()Record re-enrollment.(package private) AltingBarrierexpand()(package private) AltingBarrier[]expand(int n) (package private) voidresign()Record resignation.
-
Field Details
-
frontEnds
All front-ends are chained off here. Each process enrolled must have one, and only one, of these. -
enrolled
private int enrolledThe number of processes enrolled. -
countdown
private int countdownThe number of processes not yet offered to sync on this barrier.
-
-
Constructor Details
-
AltingBarrierBase
AltingBarrierBase()
-
-
Method Details
-
expand
-
expand
AltingBarrier expand() -
contract
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 anexpand.
-
contract
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 anexpand.
-
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.
-