Class Semaphore

Nested Relationships

Nested Types

Class Documentation

class Semaphore

Public Functions

Semaphore(long initialValue = 0)
~Semaphore()
Semaphore(const Semaphore&) = delete
Semaphore &operator=(const Semaphore&) = delete
void Post()

increment semaphore count by one

void PostAll()

signal all threads currently waiting on this semaphore

void Wait()

wait until semaphore becomes non-zero and then decrement the count by one

bool Wait(long timeoutMS)

Wait until semaphore becomes non-zero and then decrement the count by one.

Parameters

timeoutMS -- Number of milliseconds to wait for the resource before timing out

Returns

false if the wait timed out and the resource was not acquired; true if the wait succeeded and the resource was acquired.