sleep.bridges
Class Semaphore
A sleep synchronization primitive. I know Java 1.5.0 has this stuff but since Sleep targets 1.4.2
I get to provide my own. How exciting.
Semaphore(long initialCount) - initializes this semaphore with the specified initial count
|
void | P() - aquires this semaphore by attempting to decrement the count.
|
void | V() - increments this semaphore
|
long | getCount() - returns the current count data associated with this semaphore.
|
String | toString() - returns a nice string representation of this semaphore
|
Semaphore
public Semaphore(long initialCount)
initializes this semaphore with the specified initial count
P
public void P()
aquires this semaphore by attempting to decrement the count. blocks if the count is not > 0 (prior to decrement).
V
public void V()
increments this semaphore
getCount
public long getCount()
returns the current count data associated with this semaphore. note that this value is volatile
toString
public String toString()
returns a nice string representation of this semaphore