#include <cmutex.hxx>
Inheritance diagram for control::cmutex:

Public Types | |
| typedef pthread_mutex_t | mutex |
| to get the pthread_mutex_t* handle. | |
Public Member Functions | |
| cmutex () | |
| virtual | ~cmutex () |
| virtual bool | init () |
| Initialize the mutex structure. | |
| bool | lock () |
| void | unlock () |
| bool | isenabled () |
| To check if this mutex is well setup. | |
| bool | islocked () |
| unusable if a lock request is not required. This is an misthought design - this method will be removed later. | |
| mutex * | mutexhandle () const |
Protected Attributes | |
| mutex * | _mutex |
Private Attributes | |
| bool | _init |
| bool | __locked |
Definition at line 30 of file cmutex.hxx.
|
|
to get the pthread_mutex_t* handle.
Definition at line 32 of file cmutex.hxx. |
|
|
Definition at line 27 of file cmutex.cc.
|
|
|
Definition at line 33 of file cmutex.cc. References _mutex, and unlock(). 00034 {
00035 std::cerr << __PRETTY_FUNCTION__ << std::endl << '{' << std::endl << "." << std::endl;
00036
00037 if( _mutex ){
00038 unlock();
00039 pthread_mutex_destroy(_mutex);
00040 _mutex = 0l;
00041 }
00042
00043 std::cerr << std::endl << '}' << std::endl;
00044 }
|
Here is the call graph for this function:

|
|
Initialize the mutex structure.
Reimplemented in control::ccontrol. Definition at line 54 of file cmutex.cc. References __locked, _init, and _mutex. 00055 {
00056 _mutex= new pthread_mutex_t;
00057 pthread_mutex_init(_mutex, 0l);
00058 _init = true;
00059 __locked = false;
00060 return true;
00061 }
|
|
|
To check if this mutex is well setup.
Definition at line 45 of file cmutex.hxx. References _init. 00046 {
00047 return _init;
00048 }
|
|
|
unusable if a lock request is not required. This is an misthought design - this method will be removed later.
Definition at line 54 of file cmutex.hxx. References __locked. 00054 { return __locked; }
|
|
|
Definition at line 67 of file cmutex.cc. References __locked, _init, and _mutex. Referenced by control::ccontrol::wait(). 00068 {
00069 if(!_init) return false;
00070 if(__locked) return false;
00071 pthread_mutex_lock(_mutex);
00072 __locked = true;
00073 return true;
00074 }
|
|
|
Definition at line 60 of file cmutex.hxx. References _mutex. Referenced by control::ccontrol::wait(). 00060 { return _mutex; }
|
|
|
Definition at line 80 of file cmutex.cc. References __locked, _init, and _mutex. Referenced by control::ccontrol::release(), and ~cmutex(). 00081 {
00082 if(!_init) return;
00083 if(!__locked) return ;
00084 pthread_mutex_unlock(_mutex);
00085 __locked = false;
00086 }
|
|
|
Definition at line 66 of file cmutex.hxx. Referenced by init(), islocked(), lock(), and unlock(). |
|
|
Definition at line 65 of file cmutex.hxx. Referenced by init(), isenabled(), lock(), and unlock(). |
|
|
Definition at line 62 of file cmutex.hxx. Referenced by init(), lock(), mutexhandle(), unlock(), and ~cmutex(). |
1.4.0