Tesseract
3.02
|
#include <svutil.h>
Public Member Functions | |
SVSemaphore () | |
Sets up a semaphore. | |
void | Signal () |
Signal a semaphore. | |
void | Wait () |
Wait on a semaphore. |
A semaphore class which encapsulates the main signalling and wait abilities of semaphores for windows and unix.
SVSemaphore::SVSemaphore | ( | ) |
Sets up a semaphore.
Definition at line 125 of file svutil.cpp.
{ #ifdef _WIN32 semaphore_ = CreateSemaphore(0, 0, 10, 0); #else sem_init(&semaphore_, 0, 0); #endif }
void SVSemaphore::Signal | ( | ) |
Signal a semaphore.
Definition at line 133 of file svutil.cpp.
{ #ifdef _WIN32 ReleaseSemaphore(semaphore_, 1, NULL); #else sem_post(&semaphore_); #endif }
void SVSemaphore::Wait | ( | ) |
Wait on a semaphore.
Definition at line 141 of file svutil.cpp.
{ #ifdef _WIN32 WaitForSingleObject(semaphore_, INFINITE); #else sem_wait(&semaphore_); #endif }