sleep.bridges

Class Semaphore

public class Semaphore extends Object

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.
Constructor Summary
Semaphore(long initialCount)
initializes this semaphore with the specified initial count
Method Summary
longgetCount()
returns the current count data associated with this semaphore. note that this value is volatile
voidP()
aquires this semaphore by attempting to decrement the count. blocks if the count is not > 0 (prior to decrement).
StringtoString()
returns a nice string representation of this semaphore
voidV()
increments this semaphore

Constructor Detail

Semaphore

public Semaphore(long initialCount)
initializes this semaphore with the specified initial count

Method Detail

getCount

public long getCount()
returns the current count data associated with this semaphore. note that this value is volatile

P

public void P()
aquires this semaphore by attempting to decrement the count. blocks if the count is not > 0 (prior to decrement).

toString

public String toString()
returns a nice string representation of this semaphore

V

public void V()
increments this semaphore