TSim
Class Semaphore

java.lang.Object
  extended by TSim.Semaphore

public class Semaphore
extends java.lang.Object

Semaphore shared with other trains on the same track.


Method Summary
 void acquire()
          Acquire semaphore (P operation).
 void release()
          Release semaphore (V operation).
 boolean tryAcquire()
          Acquire semaphore if free.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acquire

public void acquire()
Acquire semaphore (P operation).


release

public void release()
Release semaphore (V operation).


tryAcquire

public boolean tryAcquire()
Acquire semaphore if free.

Returns:
Whether the semaphore has acquired.