Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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`
| ) |  |
| inline static

static void* createSemaphore | ( | U32 | initialCount = `1` | ) |
| inline static

static void destroySemaphore | ( | void * | semaphore | ) |
| inline static

void release | ( |  | ) |

Release the semaphore, incrementing its count. Never blocks.

static void releaseSemaphore | ( | void * | semaphore | ) |
| inline static

## Member Data Documentation

PlatformSemaphore* mData
| protected

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

- platform/threads/semaphore.h
- platformAndroid/AndroidSemaphore.cpp
- platformEmscripten/EmscriptenSemaphore.cpp