pt.ua.concurrent
Class BinarySemaphore

java.lang.Object
  extended by pt.ua.concurrent.CObject
      extended by pt.ua.concurrent.Semaphore
          extended by pt.ua.concurrent.BoundedSemaphore
              extended by pt.ua.concurrent.BinarySemaphore
All Implemented Interfaces:
InterruptibleAwaitingThreads, SyncCV

public class BinarySemaphore
extends BoundedSemaphore

Binary semaphore class.

This class follows DbC(tm) methodology (Wikipedia). Where possible, contracts are implement with native's Java assert.

Version:
0.5, November 2011
Author:
Miguel Oliveira e Silva (mos@ua.pt)

Constructor Summary
BinarySemaphore()
          Creates a binary semaphore with value 1
BinarySemaphore(int initialCount)
          Creates a binary semaphore with initial value initialCount
 
Method Summary
 
Methods inherited from class pt.ua.concurrent.BoundedSemaphore
maxCount, release
 
Methods inherited from class pt.ua.concurrent.Semaphore
aquire
 
Methods inherited from class pt.ua.concurrent.CObject
await, await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySemaphore

public BinarySemaphore()
Creates a binary semaphore with value 1


BinarySemaphore

public BinarySemaphore(int initialCount)
Creates a binary semaphore with initial value initialCount

Precondition:
initialCount >= 0 && initialCount <= 1 - valid count

Parameters:
initialCount - initial value