12 #ifndef INCLUDE_DISTORTOS_C_API_MUTEX_H_ 13 #define INCLUDE_DISTORTOS_C_API_MUTEX_H_ 118 #define DISTORTOS_MUTEX_INITIALIZER(self, type, protocol, priorityCeiling) \ 119 {ESTD_INTRUSIVELISTNODE_INITIALIZER((self).node), ESTD_INTRUSIVELIST_INITIALIZER((self).blockedList), \ 120 NULL, 0, (priorityCeiling), \ 121 (uint8_t)(((type) == distortos_Mutex_Type_normal || (type) == distortos_Mutex_Type_errorChecking || \ 122 (type) == distortos_Mutex_Type_recursive ? \ 123 (uint8_t)(type) : (uint8_t)distortos_Mutex_Type_normal) << distortos_Mutex_typeShift | \ 124 ((protocol) == distortos_Mutex_Protocol_none || (protocol) == distortos_Mutex_Protocol_priorityInheritance || \ 125 (protocol) == distortos_Mutex_Protocol_priorityProtect ? \ 126 (uint8_t)(protocol) : (uint8_t)distortos_Mutex_Protocol_none) << distortos_Mutex_protocolShift)} 142 #define DISTORTOS_MUTEX_CONSTRUCT_3(name, type, protocol, priorityCeiling) \ 143 struct distortos_Mutex name = DISTORTOS_MUTEX_INITIALIZER(name, type, protocol, priorityCeiling) 157 #define DISTORTOS_MUTEX_CONSTRUCT_2PC(name, protocol, priorityCeiling) \ 158 DISTORTOS_MUTEX_CONSTRUCT_3(name, distortos_Mutex_Type_normal, protocol, priorityCeiling) 172 #define DISTORTOS_MUTEX_CONSTRUCT_2TP(name, type, protocol) \ 173 DISTORTOS_MUTEX_CONSTRUCT_3(name, type, protocol, 0) 185 #define DISTORTOS_MUTEX_CONSTRUCT_1P(name, protocol) \ 186 DISTORTOS_MUTEX_CONSTRUCT_3(name, distortos_Mutex_Type_normal, protocol, 0) 199 #define DISTORTOS_MUTEX_CONSTRUCT_1T(name, type) \ 200 DISTORTOS_MUTEX_CONSTRUCT_3(name, type, distortos_Mutex_Protocol_none, 0) 211 #define DISTORTOS_MUTEX_CONSTRUCT(name) \ 212 DISTORTOS_MUTEX_CONSTRUCT_3(name, distortos_Mutex_Type_normal, distortos_Mutex_Protocol_none, 0) 259 const uint8_t priorityCeiling)
283 const uint8_t protocol)
static int distortos_Mutex_construct(struct distortos_Mutex *const mutex)
C-API equivalent of distortos::Mutex's constructor, type = distortos_Mutex_Type_normal,...
Definition: Mutex.h:346
C-API for estd::IntrusiveList.
uint8_t priorityCeiling
Definition: Mutex.h:58
C-API equivalent of estd::IntrusiveList.
Definition: IntrusiveList.h:32
static int distortos_Mutex_construct_1t(struct distortos_Mutex *const mutex, const uint8_t type)
C-API equivalent of distortos::Mutex's constructor, protocol = distortos_Mutex_Protocol_none,...
Definition: Mutex.h:326
int distortos_Mutex_tryLock(struct distortos_Mutex *mutex)
C-API equivalent of distortos::Mutex::tryLock()
Definition: C-API-Mutex.cpp:91
int distortos_Mutex_tryLockUntil(struct distortos_Mutex *mutex, int64_t timePoint)
C-API equivalent of distortos::Mutex::tryLockUntil()
Definition: C-API-Mutex.cpp:109
C-API equivalent of estd::IntrusiveListNode.
Definition: IntrusiveListNode.h:30
static int distortos_Mutex_construct_1p(struct distortos_Mutex *const mutex, const uint8_t protocol)
C-API equivalent of distortos::Mutex's constructor, type = distortos_Mutex_Type_normal,...
Definition: Mutex.h:304
struct estd_IntrusiveListNode node
Definition: Mutex.h:46
int distortos_Mutex_lock(struct distortos_Mutex *mutex)
C-API equivalent of distortos::Mutex::lock()
Definition: C-API-Mutex.cpp:82
uint8_t typeProtocol
Definition: Mutex.h:61
int distortos_Mutex_tryLockFor(struct distortos_Mutex *mutex, int64_t duration)
C-API equivalent of distortos::Mutex::tryLockFor()
Definition: C-API-Mutex.cpp:100
static int distortos_Mutex_construct_2tp(struct distortos_Mutex *const mutex, const uint8_t type, const uint8_t protocol)
C-API equivalent of distortos::Mutex's constructor, priorityCeiling = 0.
Definition: Mutex.h:282
void * owner
Definition: Mutex.h:52
int distortos_Mutex_construct_3(struct distortos_Mutex *mutex, uint8_t type, uint8_t protocol, uint8_t priorityCeiling)
C-API equivalent of distortos::Mutex's constructor.
Definition: C-API-Mutex.cpp:55
static int distortos_Mutex_construct_2pc(struct distortos_Mutex *const mutex, const uint8_t protocol, const uint8_t priorityCeiling)
C-API equivalent of distortos::Mutex's constructor, type = distortos_Mutex_Type_normal.
Definition: Mutex.h:258
struct estd_IntrusiveList blockedList
Definition: Mutex.h:49
uint16_t recursiveLocksCount
Definition: Mutex.h:55
C-API equivalent of distortos::Mutex.
Definition: Mutex.h:43
int distortos_Mutex_destruct(struct distortos_Mutex *mutex)
C-API equivalent of distortos::Mutex's destructor.
Definition: C-API-Mutex.cpp:72
int distortos_Mutex_unlock(struct distortos_Mutex *mutex)
C-API equivalent of distortos::Mutex::unlock()
Definition: C-API-Mutex.cpp:118