mn::basic_mutex Class Reference
#include <mn_mutex.hpp>
Inheritance diagram for mn::basic_mutex:
Collaboration diagram for mn::basic_mutex:
Public Member Functions | |
basic_mutex () | |
basic_mutex (const basic_mutex &other) | |
virtual | ~basic_mutex () |
virtual int | lock (unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_MUTEX_DEFAULT) |
virtual int | unlock () |
Public Member Functions inherited from mn::basic_semaphore | |
basic_semaphore () | |
basic_semaphore (const basic_semaphore &other) | |
basic_semaphore (basic_semaphore &&other) | |
virtual int | time_lock (const struct timespec *timeout) |
void * | get_handle () |
int | get_error () |
virtual bool | is_initialized () const |
virtual bool | is_locked () const |
Is locked? More... | |
bool | operator== (const basic_semaphore &r) const |
bool | operator!= (const basic_semaphore &r) const |
bool | operator< (const basic_semaphore &r) const |
bool | operator> (const basic_semaphore &r) const |
Public Member Functions inherited from mn::ILockObject | |
ILockObject () | |
virtual bool | try_lock () |
Additional Inherited Members | |
Public Types inherited from mn::ILockObject | |
using | this_type = ILockObject |
Protected Member Functions inherited from mn::basic_semaphore | |
void | set_error (int error) |
Protected Attributes inherited from mn::basic_semaphore | |
void * | m_pSpinlock |
int | m_iCreateErrorCode |
bool | m_isLocked |
Detailed Description
Base wrapper class around FreeRTOS's implementation of mutexes. These objects are not recursively acquirable. Calling lock() twice from the same Thread (i.e. task) will deadlock.
Constructor & Destructor Documentation
◆ basic_mutex() [1/2]
mn::basic_mutex::basic_mutex | ( | ) |
Create the mutex
- Note
- When enabled the config item MN_THREAD_CONFIG_USE_LOCK_CREATE then throw on error the lockcreate_exception exceptions and the config item MN_THREAD_CONFIG_DEBUG enabled, then with debug informations. When the config item MN_THREAD_CONFIG_USE_LOCK_CREATE disabled then get the created error code with basic_semaphore::get_error()
◆ basic_mutex() [2/2]
mn::basic_mutex::basic_mutex | ( | const basic_mutex & | other | ) |
◆ ~basic_mutex()
|
virtual |
Destrutor - destroy the mutex
Member Function Documentation
◆ lock()
|
virtual |
Lock the Mutex.
- Parameters
-
Timeout How long to wait to get the Lock until giving up. (default = 0xffffffffUL)
- Returns
- ERR_MUTEX_OK if the Lock was acquired, ERR_MUTEX_LOCK if it timed out. or ERR_MUTEX_NOTINIT when mutex not created
Reimplemented from mn::basic_semaphore.
◆ unlock()
|
virtual |
Unlock the Mutex.
- Returns
- ERR_MUTEX_OK if the Lock was released, ERR_MUTEX_UNLOCK if it failed. or ERR_MUTEX_NOTINIT when mutex not created
Reimplemented from mn::basic_semaphore.
The documentation for this class was generated from the following files: