|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpt.ua.concurrent.CObject
pt.ua.concurrent.Semaphore
public class Semaphore
A standard counting semaphore class.
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
aquire()
Acquires the semaphore. |
void |
release()
Releases the semaphore. |
Methods inherited from class pt.ua.concurrent.CObject |
---|
await, await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Semaphore()
public Semaphore(int initialCount)
initialCount >= 0
- non negative counter
initialCount
- valuepublic Semaphore(int initialCount, boolean registerAwaitingThreads)
initialCount >= 0
- non negative counter
initialCount
- valueregisterAwaitingThreads
- if true, threads are registered when waitingMethod Detail |
---|
public void aquire()
public void release()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |