Semaphore Class Reference

#include <semaphore.h>

List of all members.

Public Member Functions

 Semaphore (S32 initialCount=1)
 Create a semaphore. initialCount defaults to 1.
 ~Semaphore ()
 Delete a semaphore, ignoring it's count.
bool acquire (bool block=true)
 Acquire the semaphore, decrementing its count.
void release ()
 Release the semaphore, incrementing its count.

Protected Attributes

PlatformSemaphore * mData


Constructor & Destructor Documentation

Semaphore::Semaphore ( S32  initialCount = 1  ) 

Create a semaphore. initialCount defaults to 1.

Semaphore::~Semaphore (  ) 

Delete a semaphore, ignoring it's count.


Member Function Documentation

bool Semaphore::acquire ( bool  block = true  ) 

Acquire the semaphore, decrementing its count.

if the initial count is less than 1, block until it goes above 1, then acquire. Returns true if the semaphore was acquired, false if the semaphore could not be acquired and block was false.

void Semaphore::release (  ) 

Release the semaphore, incrementing its count.

Never blocks.


Member Data Documentation

PlatformSemaphore* Semaphore::mData [protected]