tesseract  4.00.00dev
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 90 of file svutil.h.

Constructor & Destructor Documentation

◆ SVMutex()

SVMutex::SVMutex ( )

Sets up a new mutex.

Definition at line 62 of file svutil.cpp.

62  {
63 #ifdef _WIN32
64  mutex_ = CreateMutex(0, FALSE, 0);
65 #else
66  pthread_mutex_init(&mutex_, NULL);
67 #endif
68 }
#define FALSE
Definition: capi.h:46

Member Function Documentation

◆ Lock()

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 70 of file svutil.cpp.

70  {
71 #ifdef _WIN32
72  WaitForSingleObject(mutex_, INFINITE);
73 #else
74  pthread_mutex_lock(&mutex_);
75 #endif
76 }

◆ Unlock()

void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 78 of file svutil.cpp.

78  {
79 #ifdef _WIN32
80  ReleaseMutex(mutex_);
81 #else
82  pthread_mutex_unlock(&mutex_);
83 #endif
84 }

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