Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SVSemaphore Class Reference

#include <svutil.h>

Public Member Functions

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

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.

125  {
126 #ifdef _WIN32
127  semaphore_ = CreateSemaphore(0, 0, 10, 0);
128 #else
129  sem_init(&semaphore_, 0, 0);
130 #endif
131 }

Member Function Documentation

void SVSemaphore::Signal ( )

Signal a semaphore.

Definition at line 133 of file svutil.cpp.

133  {
134 #ifdef _WIN32
135  ReleaseSemaphore(semaphore_, 1, NULL);
136 #else
137  sem_post(&semaphore_);
138 #endif
139 }
#define NULL
Definition: host.h:144
void SVSemaphore::Wait ( )

Wait on a semaphore.

Definition at line 141 of file svutil.cpp.

141  {
142 #ifdef _WIN32
143  WaitForSingleObject(semaphore_, INFINITE);
144 #else
145  sem_wait(&semaphore_);
146 #endif
147 }

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