tesseract  4.1.0
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 abilities of mutexes for windows and unix.

Definition at line 68 of file svutil.h.

Constructor & Destructor Documentation

SVMutex::SVMutex ( )

Sets up a new mutex.

Definition at line 55 of file svutil.cpp.

55  {
56 #ifdef _WIN32
57  mutex_ = CreateMutex(0, FALSE, 0);
58 #else
59  pthread_mutex_init(&mutex_, nullptr);
60 #endif
61 }
#define FALSE
Definition: capi.h:52

Member Function Documentation

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 63 of file svutil.cpp.

63  {
64 #ifdef _WIN32
65  WaitForSingleObject(mutex_, INFINITE);
66 #else
67  pthread_mutex_lock(&mutex_);
68 #endif
69 }
void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 71 of file svutil.cpp.

71  {
72 #ifdef _WIN32
73  ReleaseMutex(mutex_);
74 #else
75  pthread_mutex_unlock(&mutex_);
76 #endif
77 }

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