tesseract  4.1.1
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::SVMutex ( )

Sets up a new mutex.

Definition at line 56 of file svutil.cpp.

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

Member Function Documentation

◆ Lock()

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 64 of file svutil.cpp.

64  {
65 #ifdef _WIN32
66  WaitForSingleObject(mutex_, INFINITE);
67 #else
68  pthread_mutex_lock(&mutex_);
69 #endif
70 }

◆ Unlock()

void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 72 of file svutil.cpp.

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

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