Package org.jcsp.lang
Class AltingBarrierBase
- java.lang.Object
-
- org.jcsp.lang.AltingBarrierBase
-
class AltingBarrierBase extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private int
countdown
The number of processes not yet offered to sync on this barrier.private int
enrolled
The number of processes enrolled.private AltingBarrier
frontEnds
All front-ends are chained off here.
-
Constructor Summary
Constructors Constructor Description AltingBarrierBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
contract(AltingBarrier ab)
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 Detail
-
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.
-
-
Method Detail
-
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 anexpand
.
-
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 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.
-
-