mn::basic_semaphore Class Reference
#include <mn_basic_semaphore.hpp>
Inheritance diagram for mn::basic_semaphore:
Collaboration diagram for mn::basic_semaphore:
Public Member Functions | |
basic_semaphore () | |
basic_semaphore (const basic_semaphore &other) | |
basic_semaphore (basic_semaphore &&other) | |
virtual int | lock (unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_SEMAPHORE_DEFAULT) |
virtual int | time_lock (const struct timespec *timeout) |
virtual int | unlock () |
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 () |
Protected Member Functions | |
void | set_error (int error) |
Protected Attributes | |
void * | m_pSpinlock |
int | m_iCreateErrorCode |
bool | m_isLocked |
Additional Inherited Members | |
Public Types inherited from mn::ILockObject | |
using | this_type = ILockObject |
Detailed Description
Base wrapper class around FreeRTOS's implementation of semaphores.
Constructor & Destructor Documentation
◆ basic_semaphore() [1/3]
mn::basic_semaphore::basic_semaphore | ( | ) |
Construtor
◆ basic_semaphore() [2/3]
mn::basic_semaphore::basic_semaphore | ( | const basic_semaphore & | other | ) |
◆ basic_semaphore() [3/3]
mn::basic_semaphore::basic_semaphore | ( | basic_semaphore && | other | ) |
Member Function Documentation
◆ get_error()
|
inline |
Get the error code on creating
- Returns
- The error code on creating
◆ get_handle()
|
inline |
Get the FreeRTOS handle
- Returns
- the FreeRTOS handle
◆ is_initialized()
|
inlinevirtual |
Is the ILockObject created (initialized) ?
- Returns
- true if the ILockObject created (initialized) and false when not
Implements mn::ILockObject.
◆ is_locked()
|
inlinevirtual |
◆ lock()
|
virtual |
lock (take) a LokObject
- Parameters
-
timeout How long to wait to get the Lock until giving up.
Implements mn::ILockObject.
Reimplemented in mn::basic_mutex, and mn::basic_clock< TLockType >.
◆ operator!=()
|
inline |
◆ operator<()
|
inline |
◆ operator==()
|
inline |
◆ operator>()
|
inline |
◆ set_error()
|
inlineprotected |
Set the error codes
- Parameters
-
error The error code
◆ time_lock()
|
virtual |
lock (take) a semaphore.
- Parameters
-
abs_time How long to wait to get the lock until giving up.
- Returns
- ERR_SPINLOCK_OK if the Semaphore was locked, ERR_SPINLOCK_LOCK if it timed out.
Implements mn::ILockObject.
◆ unlock()
|
virtual |
unlock (give) a semaphore.
- Returns
- ERR_SPINLOCK_OK if the Semaphore was unlocked, ERR_SPINLOCK_UNLOCK if it failed.
Implements mn::ILockObject.
Reimplemented in mn::basic_mutex, and mn::basic_clock< TLockType >.
Member Data Documentation
◆ m_iCreateErrorCode
|
protected |
A saved / cached copy of error code on creating
◆ m_isLocked
|
protected |
◆ m_pSpinlock
|
protected |
FreeRTOS semaphore handle.
The documentation for this class was generated from the following files: