Semaphore for thread synchronization. More...
#include <cmtkThreadSemaphore.h>
Public Member Functions | |
ThreadSemaphore (const unsigned int initial=0) | |
Initialize semaphore. | |
~ThreadSemaphore () | |
Destroy semaphore object. | |
void | Post (const unsigned int increment=1) |
Post semaphore. | |
void | Wait () |
Wait for semaphore. |
Semaphore for thread synchronization.
Because apparently Apple engineers are incapable of implementing an interface for unnamed semaphores as provided by <semaphore.h>, we are building the semaphore ourselves on the Mac OS platform using a mutex and a condition variable.
Definition at line 62 of file cmtkThreadSemaphore.h.
cmtk::ThreadSemaphore::ThreadSemaphore | ( | const unsigned int | initial = 0 ) |
Initialize semaphore.
Definition at line 51 of file cmtkThreadSemaphore.cxx.
cmtk::ThreadSemaphore::~ThreadSemaphore | ( | ) |
Destroy semaphore object.
Definition at line 54 of file cmtkThreadSemaphore.cxx.
void cmtk::ThreadSemaphore::Post | ( | const unsigned int | increment = 1 ) |
Post semaphore.
Definition at line 58 of file cmtkThreadSemaphore.cxx.
Referenced by cmtk::ThreadPool::EndThreads(), and cmtk::ThreadPool::ThreadFunction().
void cmtk::ThreadSemaphore::Wait | ( | ) |
Wait for semaphore.
Definition at line 62 of file cmtkThreadSemaphore.cxx.
Referenced by cmtk::ThreadPool::ThreadFunction().