Tesseract  3.02
SVSemaphore Class Reference

#include <svutil.h>

List of all members.

Public Member Functions

 SVSemaphore ()
 Sets up a semaphore.
void Signal ()
 Signal a semaphore.
void Wait ()
 Wait on a semaphore.

Detailed Description

A semaphore class which encapsulates the main signalling and wait abilities of semaphores for windows and unix.

Definition at line 67 of file svutil.h.


Constructor & Destructor Documentation

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
}

Member Function Documentation

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
}

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