public class Semaphore extends CObject
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java assert.
| Constructor and Description |
|---|
Semaphore()
Creates a semaphore initialized with a zero counter and registering waiting threads.
|
Semaphore(int initialCount)
Creates a semaphore initialized with a given counter and registering waiting threads.
|
Semaphore(int initialCount,
boolean registerAwaitingThreads)
Creates a semaphore initialized with a given counter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acquire()
Acquires (decrements) the semaphore.
|
void |
release()
Releases (increments) the semaphore.
|
await, await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMinepublic Semaphore()
public Semaphore(int initialCount)
initialCount >= 0 - non negative counterinitialCount - valuepublic Semaphore(int initialCount,
boolean registerAwaitingThreads)
initialCount >= 0 - non negative counterinitialCount - valueregisterAwaitingThreads - if true, threads are registered when waiting