CMutex Class Reference

#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

Detailed Description

Definition at line 32 of file RioMutex.h.


Constructor & Destructor Documentation

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.

00075 {
00076     if( m_isopen )
00077     {
00078         #ifdef WINDOWS
00079         // WINDOWS32 implementation
00080         CloseHandle (m_handle);
00081         #else
00082         // UNIX implementation
00083         pthread_mutex_destroy(&m_mutex);
00084         #endif
00085     }
00086 }


Member Function Documentation

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 }


Field Documentation

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.


The documentation for this class was generated from the following files:
Generated on Wed Jul 4 16:03:31 2012 for RIO by  doxygen 1.6.3