public abstract class Barrier extends CObject
numberWaitingThreads() >= 0
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
Barrier()
Constructs a new barrier registering waiting threads.
|
Barrier(boolean registerAwaitingThreads)
Constructs a new barrier.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
await()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
abstract long |
awaitCount()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
long |
count()
Number of times the barrier was released (to be more precise: the remainder
of the integer division for 2^63)
|
abstract int |
numberWaitingThreads()
Number of threads currently waiting on the barrier.
|
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
public Barrier()
public Barrier(boolean registerAwaitingThreads)
registerAwaitingThreads
- if true, threads are registered when waitingpublic abstract int numberWaitingThreads()
public abstract void await() throws ThreadInterruptedException
count() == old(count())+ 1
await
in interface SyncCV
await
in class CObject
ThreadInterruptedException
public abstract long awaitCount() throws ThreadInterruptedException
count() == old(count())+ 1
count
ThreadInterruptedException
public long count()
count