#include <RecursiveMutex.hpp>
Inheritance diagram for RecursiveMutex::
Public Methods | |
RecursiveMutex () | |
virtual | ~RecursiveMutex () |
Protected Methods | |
virtual void | lock () |
virtual void | unlock () |
virtual void | wait () |
Private Methods | |
RecursiveMutex (const RecursiveMutex &src) | |
RecursiveMutex & | operator= (const RecursiveMutex &right) |
Private Attributes | |
unsigned int | lockCount |
pthread_t | owner |
|
Definition at line 6 of file RecursiveMutex.cpp. 00006 : lockCount(0) { } |
|
Definition at line 8 of file RecursiveMutex.cpp. 00008 { } |
|
|
|
Reimplemented from PThread_Mutex. Definition at line 10 of file RecursiveMutex.cpp. 00010 { 00011 if ( !lockCount || !pthread_equal( owner, pthread_self() ) ) { 00012 Mutex::lock(); 00013 owner = pthread_self(); 00014 } 00015 00016 ++lockCount; 00017 } |
|
|
|
Reimplemented from PThread_Mutex. Definition at line 19 of file RecursiveMutex.cpp. 00019 { 00020 00021 if ( lockCount <= 0 ) { 00022 cout << "Mutex is already unlocked.\n"; 00023 return; 00024 } 00025 00026 if ( !pthread_equal(owner, pthread_self()) ) 00027 cout << "Mutex is locked by another thread.\n"; 00028 return; 00029 } |
|
Definition at line 36 of file RecursiveMutex.cpp. 00036 { 00037 unsigned int saveCount = lockCount; 00038 lockCount = 0; 00039 Mutex::wait(); 00040 owner = pthread_self(); 00041 lockCount = saveCount; 00042 } |
|
Definition at line 34 of file RecursiveMutex.hpp. |
|
Reimplemented from PThread_Mutex. Definition at line 35 of file RecursiveMutex.hpp. |