Tesseract  3.02
SVMutex Class Reference

#include <svutil.h>

List of all members.

Public Member Functions

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

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.

                 {
#ifdef _WIN32
  mutex_ = CreateMutex(0, FALSE, 0);
#else
  pthread_mutex_init(&mutex_, NULL);
#endif
}

Member Function Documentation

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 157 of file svutil.cpp.

                   {
#ifdef _WIN32
  WaitForSingleObject(mutex_, INFINITE);
#else
  pthread_mutex_lock(&mutex_);
#endif
}
void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 165 of file svutil.cpp.

                     {
#ifdef _WIN32
  ReleaseMutex(mutex_);
#else
  pthread_mutex_unlock(&mutex_);
#endif
}

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