|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Semaphore
Uses Java monitor primitives to implement semaphore. $RCSfile: Semaphore.java,v $
| Constructor Summary | |
Semaphore()
Default constructor, initializes to 0. |
|
Semaphore(int i)
Constructor with initialization. |
|
| Method Summary | |
void |
P()
Acquires the semaphore: < await(val > 0) val = val - 1 > |
void |
V()
Releases the semaphore: < val = val + 1 > |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Semaphore(int i)
i - Initial value for semaphore (>= 0)public Semaphore()
| Method Detail |
public void V()
val = val + 1 >
public void P()
throws java.lang.InterruptedException
await(val > 0) val = val - 1 >
java.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||