#include <cmutexlock.h>

Public Member Functions | |
| CMutexLock (CMutex *mutex=NULL) | |
| void | lock (CMutex *mutex=NULL) |
| bool | tryLock (CMutex *mutex=NULL) |
| void | unlock (CMutex *mutex=NULL) |
| ~CMutexLock () | |
Private Attributes | |
| CMutex * | mMutex |
Definition at line 32 of file cmutexlock.h.
| PikeAero::CMutexLock::CMutexLock | ( | CMutex * | mutex = NULL |
) |
| PikeAero::CMutexLock::~CMutexLock | ( | ) |
Definition at line 36 of file cmutexlock.cpp.
References unlock().
00037 { 00038 unlock(); 00039 }

| void PikeAero::CMutexLock::lock | ( | CMutex * | mutex = NULL |
) |
Definition at line 41 of file cmutexlock.cpp.
References disableInterrupts, interruptsEnabled, PikeAero::CMutex::mLocked, mMutex, setInterrupts, and PikeAero::CTaskScheduler::yield().
Referenced by CMutexLock().
00042 { 00043 if ( mutex != NULL ) mMutex = mutex; 00044 if ( mMutex != NULL ) 00045 { 00046 bool gotLock=false; 00047 while ( !gotLock ) 00048 { 00049 CTaskScheduler::yield(); 00050 bool irqState = interruptsEnabled(); 00051 disableInterrupts(); 00052 if ( !mMutex->mLocked ) 00053 { 00054 mMutex->mLocked = true; 00055 gotLock=true; 00056 } 00057 setInterrupts(irqState); 00058 } 00059 } 00060 }


| bool PikeAero::CMutexLock::tryLock | ( | CMutex * | mutex = NULL |
) |
Definition at line 71 of file cmutexlock.cpp.
References PikeAero::CMutex::mLocked, and mMutex.
00072 { 00073 if ( mutex != NULL ) mMutex = mutex; 00074 if ( mMutex != NULL ) 00075 { 00076 return mMutex->mLocked; 00077 } 00078 return false; 00079 }
| void PikeAero::CMutexLock::unlock | ( | CMutex * | mutex = NULL |
) |
Definition at line 62 of file cmutexlock.cpp.
References PikeAero::CMutex::mLocked, and mMutex.
Referenced by ~CMutexLock().
00063 { 00064 if ( mutex != NULL ) mMutex = mutex; 00065 if ( mMutex != NULL ) 00066 { 00067 mMutex->mLocked = false; 00068 } 00069 }

CMutex* PikeAero::CMutexLock::mMutex [private] |
Definition at line 43 of file cmutexlock.h.
Referenced by CMutexLock(), lock(), tryLock(), and unlock().
1.5.8