|
Devel Lib
|
A class for handling recursive mutexes. More...
#include <Mutex.h>
Public Member Functions | |
| CMutex ()=default | |
| Default constructor for CMutex. | |
| virtual | ~CMutex ()=default |
| Default virtual destructor for CMutex. | |
| void | lock () const |
| Locks the mutex. If the mutex is currently locked by another thread, this call will block the calling thread until the mutex is unlocked. | |
| void | unlock () const |
| Unlocks the mutex. | |
| bool | tryLock () const |
| Attempts to lock the mutex. If the mutex is not available for locking, this function returns immediately with a value of false. If the mutex is available for locking, the function locks the mutex and returns true. More... | |
A class for handling recursive mutexes.
This class encapsulates a std::recursive_mutex, providing an interface for locking and unlocking the mutex.
Example
This class must be used when you want to protect a shared resource from simultaneous access by multiple threads. Here is a simple usage example:
|
inline |
Attempts to lock the mutex. If the mutex is not available for locking, this function returns immediately with a value of false. If the mutex is available for locking, the function locks the mutex and returns true.