pops.ale.engine.input.connectors
Class Semaphore

java.lang.Object
  extended by pops.ale.engine.input.connectors.Semaphore

public class Semaphore
extends java.lang.Object

Binary semaphore class.

Author:
rdagher

Constructor Summary
Semaphore()
           
 
Method Summary
 boolean getFlag()
           
 void lock(boolean condition)
          Blocks until the signal method is called.
 void setFlag(boolean value)
           
 void signal(boolean condition)
          Sets the semaphore flag, and notifies waiting threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Semaphore

public Semaphore()
Method Detail

setFlag

public void setFlag(boolean value)

getFlag

public boolean getFlag()

lock

public void lock(boolean condition)
          throws java.lang.InterruptedException
Blocks until the signal method is called.

Parameters:
condition - boolean value.
Throws:
java.lang.InterruptedException

signal

public void signal(boolean condition)
Sets the semaphore flag, and notifies waiting threads.

Parameters:
condition - boolean value.
Throws:
java.lang.InterruptedException