The Mutex class: Scope based mutex semaphore. The ifw::core::utils::system::Mutex semaphore is used to implement a safe mutex semaphore, at scope level. When entering the scope the semaphore is automatically created, based on a ID, if not existing, and locked. The semaphore created is recursive. When leaving the scope, the destructor will automatically unlock the semaphore.
More...
#include <system.hpp>
|
| static void | Clear () |
| | Releases (deletes) all semaphores allocated. Use with caution!!
|
| |
The Mutex class: Scope based mutex semaphore. The ifw::core::utils::system::Mutex semaphore is used to implement a safe mutex semaphore, at scope level. When entering the scope the semaphore is automatically created, based on a ID, if not existing, and locked. The semaphore created is recursive. When leaving the scope, the destructor will automatically unlock the semaphore.
Example:
ifw::core::utils::system::Mutex tmp_mutex("MySemId"); { ... critical section ... }
Using the macros for this, makes critical sections in the code more conspicuous, i.e.:
BEGIN_CRIT_SEC("MySemId") { ... critical section ... } END_CRIT_SEC();
◆ Mutex()
| ifw::core::utils::system::Mutex::Mutex |
( |
const std::string & | id | ) |
|
|
explicit |
◆ ~Mutex()
| ifw::core::utils::system::Mutex::~Mutex |
( |
| ) |
|
◆ Clear()
| void ifw::core::utils::system::Mutex::Clear |
( |
| ) |
|
|
static |
Releases (deletes) all semaphores allocated. Use with caution!!
◆ Id()
| const std::string & ifw::core::utils::system::Mutex::Id |
( |
| ) |
const |
◆ Lock()
| void ifw::core::utils::system::Mutex::Lock |
( |
| ) |
|
◆ Unlock()
| void ifw::core::utils::system::Mutex::Unlock |
( |
| ) |
|
The documentation for this class was generated from the following files: