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

#include <svutil.h>

Public Member Functions

 SVMutex ()
 Sets up a new mutex. More...
 
void Lock ()
 Locks on a mutex. More...
 
void Unlock ()
 Unlocks on a mutex. More...
 

Detailed Description

A mutex which encapsulates the main locking and unlocking abilites of mutexes for windows and unix.

Definition at line 85 of file svutil.h.

Constructor & Destructor Documentation

SVMutex::SVMutex ( )

Sets up a new mutex.

Definition at line 149 of file svutil.cpp.

149  {
150 #ifdef _WIN32
151  mutex_ = CreateMutex(0, FALSE, 0);
152 #else
153  pthread_mutex_init(&mutex_, NULL);
154 #endif
155 }
#define NULL
Definition: host.h:144
#define FALSE
Definition: capi.h:28

Member Function Documentation

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 157 of file svutil.cpp.

157  {
158 #ifdef _WIN32
159  WaitForSingleObject(mutex_, INFINITE);
160 #else
161  pthread_mutex_lock(&mutex_);
162 #endif
163 }
void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 165 of file svutil.cpp.

165  {
166 #ifdef _WIN32
167  ReleaseMutex(mutex_);
168 #else
169  pthread_mutex_unlock(&mutex_);
170 #endif
171 }

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