Logo
~Sockets~
~Examples~
~Contact~


Mutex Class Reference
[Threading]

Mutex container class, used by Lock. More...

#include <Mutex.h>

List of all members.


Public Member Functions

 Mutex ()
 ~Mutex ()
void Lock ()
void Unlock ()

Private Attributes

pthread_mutex_t m_mutex

Friends

class Lock

Detailed Description

Mutex container class, used by Lock.

Definition at line 46 of file Mutex.h.


Constructor & Destructor Documentation

Mutex::Mutex (  ) 

Definition at line 37 of file Mutex.cpp.

References m_mutex.

00038 {
00039 #ifdef _WIN32
00040         m_mutex = ::CreateMutex(NULL, FALSE, NULL);
00041 #else
00042         pthread_mutex_init(&m_mutex, NULL);
00043 #endif
00044 }

Mutex::~Mutex (  ) 

Definition at line 47 of file Mutex.cpp.

References m_mutex.

00048 {
00049 #ifdef _WIN32
00050         ::CloseHandle(m_mutex);
00051 #else
00052         pthread_mutex_destroy(&m_mutex);
00053 #endif
00054 }


Member Function Documentation

void Mutex::Lock (  ) 

void Mutex::Unlock (  ) 

Definition at line 68 of file Mutex.cpp.

References m_mutex.

Referenced by SocketHandler::Select(), Lock::~Lock(), and SocketHandler::~SocketHandler().

00069 {
00070 #ifdef _WIN32
00071         ::ReleaseMutex(m_mutex);
00072 #else
00073         pthread_mutex_unlock(&m_mutex);
00074 #endif
00075 }


Friends And Related Function Documentation

void Mutex::Lock [friend]

Definition at line 48 of file Mutex.h.

Referenced by Lock::Lock(), SocketHandler::Select(), and SocketHandler::SocketHandler().


Member Data Documentation

pthread_mutex_t Mutex::m_mutex [private]

Definition at line 59 of file Mutex.h.

Referenced by Mutex(), Unlock(), and ~Mutex().


The documentation for this class was generated from the following files:
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4