Torque2D Reference
Loading...
Searching...
No Matches
Semaphore Class Reference

#include <semaphore.h>

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, 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

PlatformSemaphoremData

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

◆ acquire()

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.

◆ acquireSemaphore()

bool acquireSemaphore ( void * semaphore,
bool block = true )
inlinestatic

◆ createSemaphore()

void * createSemaphore ( U32 initialCount = 1)
inlinestatic

◆ destroySemaphore()

void destroySemaphore ( void * semaphore)
inlinestatic

◆ release()

void release ( )

Release the semaphore, incrementing its count. Never blocks.

◆ releaseSemaphore()

void releaseSemaphore ( void * semaphore)
inlinestatic

Member Data Documentation

◆ mData

PlatformSemaphore* mData
protected

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