|
enum | EFlags { eFlgNone = 0x00000000
, eFlgClassic = 0x00000001
, eFlgReclaimLock = 0x00000002
} |
|
|
const char * | m_pName |
| name of mutex
|
|
tTaskId | m_idOwner |
| owner of mutex (0->free)
|
|
tTaskId | m_idFstWaiting |
| id of first task waiting for the mutex
|
|
tTaskId | m_idLstWaiting |
| id of last task waiting for the mutex
|
|
uint32 | m_uCounter |
| number of times the owner 'owns' the mutex
|
|
SINOSCoreLock | m_Lock |
| core lock
|
|
uint32 | m_uFlags |
| mutex flags
|
|
◆ CINOSMutex() [1/2]
CINOSMutex::CINOSMutex |
( |
EFlags |
aeFlags | ) |
|
|
explicit |
Create a mutex with the given name.
- Parameters
-
aeFlags | Defines whether to use a standard or classic mutex. Classic mutexes didn't support a recursive behaviour and should bot be used anymore. |
◆ CINOSMutex() [2/2]
CINOSMutex::CINOSMutex |
( |
const char * |
apName = 0 , |
|
|
EFlags |
aeFlags = eFlgNone |
|
) |
| |
Create a mutex with the given name.
- Parameters
-
apName | Name of mutex |
aeFlags | Defines whether to use a standard or classic mutex. Classic mutexes didn't support a recursive behaviour and should not be used anymore. |
◆ lock()
ICACHE void CINOSMutex::lock |
( |
| ) |
|
|
inline |
To make this class compatible with C++11's unique_lock, used by 'condition variables'.
◆ Release()
Releases a previously requested mutex (and suspend task atomically). Note that it is a failure to release a mutex which has not been requested before. In that sense, a calling task should call Release as many times as it successfully called Request. On the other side, it is not allowed to call Release if a previous call to Request failed.
- Parameters
-
aSuspend | True if atomic suspend requested |
◆ Request()
ICACHE uint32 CINOSMutex::Request |
( |
uint32 |
aTimeout = INOS_WAIT_FOREVER | ) |
|
Request mutex. By default, the same task may call this function multiple times (recursive mutex). This behavior can be changed at object construction time (see aeFlags).
- Parameters
-
aTimeout | Must be either INOS_WAIT_FOREVER or INOS_NO_WAIT |
- Returns
- 1 if requesting the mutex succeeded, 0 otherwise. The value 0 may only occur if INOS_NO_WAIT was passed.
◆ try_lock()
bool CINOSMutex::try_lock |
( |
| ) |
|
|
inline |
To make this class compatible with C++11's unique_lock, used by 'condition variables'.
◆ TryRequest()
bool CINOSMutex::TryRequest |
( |
| ) |
|
Tries to request the mutex without blocking. IOW: If the mutex is not yet locked, the caller causes the mutex to be locked afterwards. If the mutex is already locked, the caller will not get the mutex, but it won't be blocked either.
- Returns
- true if the caller got the mutex, false otherwise.
◆ unlock()
ICACHE void CINOSMutex::unlock |
( |
| ) |
|
|
inline |
To make this class compatible with C++11's unique_lock, used by 'condition variables'.
The documentation for this class was generated from the following file:
- /home/jenkins/workspace/inos_doxygen/os/inos/inc/cinosmutex.h