Package org.jcsp.lang
Class AltingBarrierBase
java.lang.Object
org.jcsp.lang.AltingBarrierBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
The number of processes not yet offered to sync on this barrier.private int
The number of processes enrolled.private AltingBarrier
All front-ends are chained off here. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
This removes the given front-end chained to this alting barrier.(package private) void
contract
(AltingBarrier[] ab) This removes the given front-ends chained to this alting barrier.(package private) boolean
disable()
Withdraw the offer to synchronise.(package private) boolean
enable()
Record the offer to synchronise.(package private) void
enroll()
Record re-enrollment.(package private) AltingBarrier
expand()
(package private) AltingBarrier[]
expand
(int n) (package private) void
resign()
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.
-