StateOS
Loading...
Searching...
No Matches
stateos::Mutex Struct Reference

create and initialize a mutex object More...

#include <osmutex.h>

Inheritance diagram for stateos::Mutex:

Public Types

using Ptr = std::unique_ptr<Mutex>
 result type of Create()

Public Member Functions

constexpr Mutex ()
 constructor, see the constructor parameters of the class
constexpr Mutex (const unsigned _mode, const unsigned _prio=0)
 constructor, see the constructor parameters of the class
 Mutex (Mutex &&_src)
 move constructor
 Mutex (const Mutex &)=delete
Mutex & operator= (Mutex &&)=delete
Mutex & operator= (const Mutex &)=delete
void reset ()
 mtx_reset()
void kill ()
 mtx_kill()
void destroy ()
 mtx_destroy()
unsigned prio ()
 mtx_prio()
int take ()
 mtx_take()
int tryLock ()
 mtx_tryLock()
template<typename T>
int waitFor (const T &_delay)
 mtx_waitFor()
template<typename T>
int waitUntil (const T &_time)
 mtx_waitUntil()
int wait ()
 mtx_wait()
int lock ()
 mtx_lock()
int give ()
 mtx_give()
int unlock ()
 mtx_unlock()

Static Public Member Functions

static Ptr Create (const unsigned _mode, const unsigned _prio=0)
 create dynamic object with manageable resources

Detailed Description

create and initialize a mutex object

Constructor parameters
  • mode: mutex mode (mutex type + mutex protocol + mutex robustness)
    • type: mtxNormal or mtxErrorCheck or mtxRecursive
    • protocol: mtxPrioNone or mtxPrioInherit or mtxPrioProtect
    • robustness: mtxStalled or mtxRobust
  • prio: mutex priority ceiling; used only with mtxPrioProtect protocol

Member Function Documentation

◆ Create()

Ptr stateos::Mutex::Create ( const unsigned _mode,
const unsigned _prio = 0 )
inlinestatic

create dynamic object with manageable resources

Parameters
_modemutex mode (mutex type + mutex protocol + mutex robustness)
  • type: mtxNormal or mtxErrorCheck or mtxRecursive
  • protocol: mtxPrioNone or mtxPrioInherit or mtxPrioProtect
  • robustness: mtxStalled or mtxRobust
_priomutex priority ceiling; used only with mtxPrioProtect protocol
Returns
std::unique_pointer / pointer to Mutex object
Note
use only in thread mode

The documentation for this struct was generated from the following file: