Public Member Functions | Private Attributes | List of all members
FIX::Mutex Class Reference

Portable implementation of a mutex. More...

#include <Mutex.h>

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 
void lock ()
 
void unlock ()
 

Private Attributes

pthread_mutex_t m_mutex
 
pthread_t m_threadID
 
int m_count
 

Detailed Description

Portable implementation of a mutex.

Definition at line 47 of file Mutex.h.

Constructor & Destructor Documentation

◆ Mutex()

FIX::Mutex::Mutex ( )
inline

Definition at line 67 of file Mutex.h.

71  {
72 #ifdef _MSC_VER
73  LeaveCriticalSection( &m_mutex );
74 #else
75  if ( m_count > 1 )
76  { m_count--; return ; }
77  --m_count;
78  m_threadID = 0;
79  pthread_mutex_unlock( &m_mutex );
80 #endif

◆ ~Mutex()

FIX::Mutex::~Mutex ( )
inline

Definition at line 82 of file Mutex.h.

83  :
84 
85 #ifdef _MSC_VER
86  CRITICAL_SECTION m_mutex;
87 #else
88  pthread_mutex_t m_mutex;
89  pthread_t m_threadID;

Member Function Documentation

◆ lock()

void FIX::Mutex::lock ( )
inline

Definition at line 91 of file Mutex.h.

96 {
97 public:
98  Locker( Mutex& mutex )
99  : m_mutex( mutex )
100  {
101  m_mutex.lock();
102  }

◆ unlock()

void FIX::Mutex::unlock ( )
inline

Definition at line 104 of file Mutex.h.

105  {
106  m_mutex.unlock();
107  }
108 private:
109  Mutex& m_mutex;
110 };
111 
113 class ReverseLocker
114 {
115 public:

References FIX::Locker::m_mutex, and unlock().

Referenced by FIX::Locker::Locker(), and unlock().

Member Data Documentation

◆ m_count

int FIX::Mutex::m_count
private

Definition at line 124 of file Mutex.h.

◆ m_mutex

pthread_mutex_t FIX::Mutex::m_mutex
private

Definition at line 122 of file Mutex.h.

◆ m_threadID

pthread_t FIX::Mutex::m_threadID
private

Definition at line 123 of file Mutex.h.


The documentation for this class was generated from the following file:
FIX::Mutex::Mutex
Mutex()
Definition: Mutex.h:67
FIX::Mutex::m_threadID
pthread_t m_threadID
Definition: Mutex.h:123
FIX::Mutex::m_mutex
pthread_mutex_t m_mutex
Definition: Mutex.h:122
FIX::Mutex::m_count
int m_count
Definition: Mutex.h:124

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001