Go to the documentation of this file.
28 #if !defined( INC_CINOSMUTEX_H )
29 #define INC_CINOSMUTEX_H
44 eFlgNone = 0x00000000,
46 eFlgClassic = 0x00000001,
48 eFlgReclaimLock = 0x00000002,
64 CINOSMutex(
const char* apName = 0, EFlags aeFlags = eFlgNone);
77 ICACHE uint32
Request(uint32 aTimeout=INOS_WAIT_FOREVER);
109 ICACHE
void Release(
bool aSuspend=
false, uint32 auState = defINOSTaskPureSuspended);
129 {
return m_Lock.GetAddr(); };
210 :
m_pMutex(aMutex.TryRequest() ? &aMutex : nullptr)
237 operator bool()
const {
252 #endif // INC_CINOSMUTEX_h
ICACHE uint32 Request(uint32 aTimeout=INOS_WAIT_FOREVER)
Definition: cinosmutex.h:35
ICACHE class CINOSTask * GetOwner()
Return id of mutex owner.
Definition: cinosmutex.h:118
bool try_lock()
Definition: cinosmutex.h:97
tTaskId m_idFstWaiting
id of first task waiting for the mutex
Definition: cinosmutex.h:148
const char * GetName()
Return mutex name.
Definition: cinosmutex.h:123
ICACHE void lock()
Definition: cinosmutex.h:80
~CINOSTryLock()
Release the owned mutex.
Definition: cinosmutex.h:216
Definition: inostype.h:257
CINOSMutex * m_pMutex
pointer to the owned mutex
Definition: cinosmutex.h:187
ICACHE void Release(bool aSuspend=false, uint32 auState=defINOSTaskPureSuspended)
void EarlyUnlock()
Release the owned mutex. Can be used to release the mutex before the destructor is called....
Definition: cinosmutex.h:225
CINOSLock(CINOSMutex &aMutex)
Request the given mutex. See also Critical sections.
Definition: cinosmutex.h:175
Definition: inostype.h:192
Definition: cinosmutex.h:166
CINOSMutex * m_pMutex
pointer to the owned mutex
Definition: cinosmutex.h:245
~CINOSLock()
Release the owned mutex.
Definition: cinosmutex.h:180
CINOSMutex(EFlags aeFlags)
Create a mutex with the given name.
#define DECLARE_DYNAMIC_PLACEMENT(aClass)
Definition: cinospartitionmemory.h:348
SINOSCoreLock m_Lock
core lock
Definition: cinosmutex.h:151
tTaskId m_idOwner
owner of mutex (0->free)
Definition: cinosmutex.h:147
void ClrFlag(EFlags aeFlag)
clears the given mutex flag.
ICACHE void unlock()
Definition: cinosmutex.h:112
uint32 m_uCounter
number of times the owner 'owns' the mutex
Definition: cinosmutex.h:150
const char * m_pName
name of mutex
Definition: cinosmutex.h:146
void EarlyUnlock()
Release the owned mutex. Can be used to release the mutex before the destructor is called.
Definition: cinosmutex.h:186
volatile uint32 * GetLockAdr()
Return pointer to core locking structure.
Definition: cinosmutex.h:128
~CINOSMutex()
Destroy mutex. It is not allowed to destroy a mutex with still waiting tasks. This ends up in an asse...
tTaskId m_idLstWaiting
id of last task waiting for the mutex
Definition: cinosmutex.h:149
uint32 m_uFlags
mutex flags
Definition: cinosmutex.h:152
Definition: cinosmutex.h:197
#define DECLARE_DYNAMIC(aClass)
Definition: cinospartitionmemory.h:328
void SetFlag(EFlags aeFlag)
sets the given mutex flag.
CINOSTryLock(CINOSMutex &aMutex)
Try to request the given mutex. IOW: Locks if mutex is not held by another task, but does nothing oth...
Definition: cinosmutex.h:209
Definition: cinostask.h:51