Package es.upm.babel.cclib
Class Semaphore
- java.lang.Object
-
- es.upm.babel.cclib.Semaphore
-
public class Semaphore extends java.lang.Object
Counting Semaphore.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
await()
The Dijkstra P operation: delays until the internal counter is greater than 0 and then decrements it.static void
setMeanSleepAfterAwait(int ms)
If the parameter is greater than 0 more arbitrary interleavings will be introduced.void
signal()
The Dijkstra V operation: increments the internal counter.
-
-
-
Method Detail
-
setMeanSleepAfterAwait
public static void setMeanSleepAfterAwait(int ms)
If the parameter is greater than 0 more arbitrary interleavings will be introduced.
-
await
public void await()
The Dijkstra P operation: delays until the internal counter is greater than 0 and then decrements it. The usual name of this method is wait but, unfortunately, wait is an important predefined method in Object and we don't want to invalidate its semantics.
-
signal
public void signal()
The Dijkstra V operation: increments the internal counter.
-
-