Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Semaphore Class Reference

#include <semaphore.h>

Public Member Functions

 Semaphore (S32 initialCount=1)
 Create a semaphore. initialCount defaults to 1. More...
 
 ~Semaphore ()
 Delete a semaphore, ignoring it's count. More...
 
bool acquire (bool block=true, S32 timeoutMS=-1)
 
void release ()
 

Static Public Member Functions

static void * createSemaphore (U32 initialCount=1)
 
static void destroySemaphore (void *semaphore)
 
static bool acquireSemaphore (void *semaphore, bool block=true)
 
static void releaseSemaphore (void *semaphore)
 

Protected Attributes

PlatformSemaphore * mData
 

Constructor & Destructor Documentation

Semaphore ( S32  initialCount = 1)

Create a semaphore. initialCount defaults to 1.

~Semaphore ( )

Delete a semaphore, ignoring it's count.

Member Function Documentation

bool acquire ( bool  block = true,
S32  timeoutMS = -1 
)

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.

static bool acquireSemaphore ( void *  semaphore,
bool  block = true 
)
inlinestatic
static void* createSemaphore ( U32  initialCount = 1)
inlinestatic
static void destroySemaphore ( void *  semaphore)
inlinestatic
void release ( )

Release the semaphore, incrementing its count. Never blocks.

static void releaseSemaphore ( void *  semaphore)
inlinestatic

Member Data Documentation

PlatformSemaphore* mData
protected

The documentation for this class was generated from the following file: