![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
#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 |
Definition at line 30 of file Mutex.h.
|
|
Definition at line 33 of file Mutex.h. References m_count, and m_threadID.
00034 {
00035 #ifdef _MSC_VER
00036 InitializeCriticalSection( &m_mutex );
00037 #else
00038 m_count = 0;
00039 m_threadID = 0;
00040 //pthread_mutexattr_t attr;
00041 //pthread_mutexattr_init(&attr);
00042 //pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
00043 //pthread_mutex_init(&m_mutex, &attr);
00044 pthread_mutex_init( &m_mutex, 0 );
00045 #endif
00046 }
|
|
|
Definition at line 48 of file Mutex.h.
00049 {
00050 #ifdef _MSC_VER
00051 DeleteCriticalSection( &m_mutex );
00052 #else
00053 pthread_mutex_destroy( &m_mutex );
00054 #endif
00055 }
|
|
|
Definition at line 57 of file Mutex.h. References m_count, and m_threadID. Referenced by FIX::Locker::Locker(), and FIX::ReverseLocker::~ReverseLocker().
00058 {
00059 #ifdef _MSC_VER
00060 EnterCriticalSection( &m_mutex );
00061 #else
00062 if ( m_count && m_threadID == pthread_self() )
00063 { ++m_count; return ; }
00064 pthread_mutex_lock( &m_mutex );
00065 ++m_count;
00066 m_threadID = pthread_self();
00067 #endif
00068 }
|
|
|
Definition at line 70 of file Mutex.h. References m_count, and m_threadID. Referenced by FIX::ReverseLocker::ReverseLocker(), and FIX::Locker::~Locker().
00071 {
00072 #ifdef _MSC_VER
00073 LeaveCriticalSection( &m_mutex );
00074 #else
00075 if ( m_count > 1 )
00076 { m_count--; return ; }
00077 --m_count;
00078 m_threadID = 0;
00079 pthread_mutex_unlock( &m_mutex );
00080 #endif
00081 }
|
|
|
|
|
|
|
|
|
|
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001