Semaphore

Engine/source/platform/threads/semaphore.h

More...

Protected Attributes

Public Functions

Semaphore(S32 initialCount)

Create a semaphore. initialCount defaults to 1.

Delete a semaphore, ignoring it's count.

bool
acquire(bool block, S32 timeoutMS)

Acquire the semaphore, decrementing its count.

Release the semaphore, incrementing its count.

Detailed Description

Protected Attributes

PlatformSemaphore * mData 

Public Functions

Semaphore(S32 initialCount)

Create a semaphore. initialCount defaults to 1.

~Semaphore()

Delete a semaphore, ignoring it's count.

acquire(bool block, S32 timeoutMS)

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.

release()

Release the semaphore, incrementing its count.

Never blocks.