All Packages Class Hierarchy This Package Previous Next Index
Class eduni.simjava.Semaphore
java.lang.Object
|
+----eduni.simjava.Semaphore
- public class Semaphore
- extends Object
This is a counting semaphore class. It is used internally by the
Sim_system to
synchronise the running of the threaded Sim_entities. It should not
be needed in user simulations.
- See Also:
- Sim_system
-
Semaphore()
- Allocate a new Semaphore object, with an initial count of zero.
-
Semaphore(int)
- Allocates a new Semaphore object, with a given initial count.
-
p()
- Try to obtain the Semaphore.
-
v()
- Free the Semaphore, by incrementing the internal count.
Semaphore
public Semaphore()
- Allocate a new Semaphore object, with an initial count of zero.
Semaphore
public Semaphore(int count)
- Allocates a new Semaphore object, with a given initial count.
- Parameters:
- count - The initial count of the semaphore.
p
public synchronized void p()
- Try to obtain the Semaphore. If the count is above zero, the
function decrements it, then return so the calling thread can
continue. If the count is zero then the calling thread is suspended
until it becomes non-zero.
v
public synchronized void v()
- Free the Semaphore, by incrementing the internal count.
All Packages Class Hierarchy This Package Previous Next Index