[DEV] add interface auto-remove Mutex
This commit is contained in:
parent
9c6c819288
commit
45602989a0
@ -1618,6 +1618,7 @@ template<class CLASS_TYPE> class RegExp {
|
||||
*/
|
||||
std::string getRegExDecorated(void) {
|
||||
// TODO : do it...
|
||||
return "";
|
||||
}
|
||||
private:
|
||||
/**
|
||||
|
@ -52,7 +52,29 @@ namespace etk {
|
||||
*/
|
||||
void unLock(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief AutoLock and un-lock when exit fuction.
|
||||
*/
|
||||
class AutoLockMutex {
|
||||
private:
|
||||
// Keep a reference on the mutex
|
||||
etk::Mutex &m_protect;
|
||||
public:
|
||||
/**
|
||||
* @brief constructor that automaticly lock the mutex.
|
||||
* @param[in] _protect Mutex to Lock.
|
||||
*/
|
||||
AutoLockMutex(etk::Mutex& _protect) :
|
||||
m_protect(_protect) {
|
||||
m_protect.lock();
|
||||
}
|
||||
/**
|
||||
* @brief Destructor that Auto Unlock mutex when remove.
|
||||
*/
|
||||
virtual ~AutoLockMutex(void){
|
||||
m_protect.unLock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user