#include <RioMutex.h>
Public Member Functions | |
bool | IsOpen () |
void | Release () |
void | Wait () |
CMutex () | |
virtual | ~CMutex () |
Private Attributes | |
pthread_mutex_t | m_mutex |
bool | m_isopen |
Definition at line 32 of file RioMutex.h.
CMutex::CMutex | ( | ) |
Definition at line 47 of file RioMutex.cpp.
00048 { 00049 #ifdef WINDOWS 00050 // WINDOWS32 implementation 00051 m_handle = CreateMutex( NULL, FALSE, NULL ); 00052 if( m_handle == INVALID_HANDLE_VALUE ) 00053 { 00054 m_isopen = false; 00055 } 00056 else 00057 { 00058 m_isopen = true; 00059 } 00060 #else 00061 // UNIX implementation 00062 int result = pthread_mutex_init( &m_mutex, NULL ); 00063 if( result == 0 ) 00064 { 00065 m_isopen = true; 00066 } 00067 else 00068 { 00069 m_isopen = false; 00070 } 00071 #endif 00072 }
CMutex::~CMutex | ( | ) | [virtual] |
Definition at line 74 of file RioMutex.cpp.
bool CMutex::IsOpen | ( | ) |
Definition at line 110 of file RioMutex.cpp.
00111 { 00112 return m_isopen; 00113 }
void CMutex::Release | ( | ) |
Definition at line 99 of file RioMutex.cpp.
00100 { 00101 #ifdef WINDOWS 00102 // WINDOWS32 implementation 00103 ReleaseMutex( m_handle ); 00104 #else 00105 // UNIX implementation 00106 pthread_mutex_unlock( &m_mutex ); 00107 #endif 00108 }
void CMutex::Wait | ( | ) |
Definition at line 88 of file RioMutex.cpp.
00089 { 00090 #ifdef WINDOWS 00091 // WINDOWS32 implementation 00092 WaitForSingleObject(m_handle,INFINITE); 00093 #else 00094 // UNIX implementation 00095 pthread_mutex_lock( &m_mutex ); 00096 #endif 00097 }
bool CMutex::m_isopen [private] |
Definition at line 43 of file RioMutex.h.
pthread_mutex_t CMutex::m_mutex [private] |
Definition at line 40 of file RioMutex.h.