public class FixedBarrier extends InternalBarrier
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
FixedBarrier(int size)
Constructs a new fixed size barrier for
size threads registering waiting threads. |
FixedBarrier(int size,
boolean registerAwaitingThreads)
Constructs a new fixed size barrier for
size threads. |
Modifier and Type | Method and Description |
---|---|
void |
await()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
long |
awaitCount()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
int |
numberWaitingThreads()
Number of threads currently waiting on the barrier.
|
void |
setSize(int size)
Define a new size for the barrier.
|
int |
size()
Number of threads defined for the barrier.
|
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
public FixedBarrier(int size)
size
threads registering waiting threads.
size > 0
size
- barrier's number of threadspublic FixedBarrier(int size, boolean registerAwaitingThreads)
size
threads.
size > 0
size
- barrier's number of threadsregisterAwaitingThreads
- if true, threads are registered when waitingpublic void setSize(int size)
size > 0
size
- barrier's number of threadspublic int size()
InternalBarrier
size
in class InternalBarrier
public int numberWaitingThreads()
Barrier
numberWaitingThreads
in class Barrier
public void await() throws ThreadInterruptedException
Barrier
count() == old(count())+ 1
await
in interface SyncCV
await
in class Barrier
ThreadInterruptedException
public long awaitCount() throws ThreadInterruptedException
Barrier
count() == old(count())+ 1
awaitCount
in class Barrier
count
ThreadInterruptedException