moss.kernel
Class Semaphore

java.lang.Object
  extended by moss.kernel.Semaphore

public class Semaphore
extends java.lang.Object

This class provides a low-level semaphore. Unlike MSemaphore(), this will "hold up" a virtual-processor if it waits.


Constructor Summary
Semaphore()
          creates and initialises a semaphore (default is to 1, for a mutex)
Semaphore(int value)
          creates and initialises a semaphore to the given value
 
Method Summary
 void sem_signal()
          signal this semaphore
 boolean sem_wait()
          wait on this semaphore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Semaphore

public Semaphore()
creates and initialises a semaphore (default is to 1, for a mutex)


Semaphore

public Semaphore(int value)
creates and initialises a semaphore to the given value

Parameters:
value - initial semaphore value
Method Detail

sem_wait

public boolean sem_wait()
wait on this semaphore

Returns:
true if the wait completed successfully, false if the (Java) thread was interrupted whilst waiting

sem_signal

public void sem_signal()
signal this semaphore