Components/Libraries/XF/FreeRTOS/Mutex
Sara.chalokh (Talk | contribs) (→bool exitFromISR()) |
Sara.chalokh (Talk | contribs) (→bool isCreated()) |
||
Line 37: | Line 37: | ||
== bool isCreated() == | == bool isCreated() == | ||
=== Description === | === Description === | ||
+ | This function just return true if the mutex has been created successfully, else false. |
Latest revision as of 14:21, 10 August 2017
|
Mutex
Mutexes are like BinarySemaphores but they include an inheritance mechanism. This means that if a high priority task blocks while attempting to obtain a mutex (entered) that is currently held by a lower priority task, then the priority of the task holding the token is temporarily raised to that of the blocking task.This mechanism is designed to ensure the higher priority task is kept in the blocked state for the shortest time possible, and in so doing minimize the 'priority inversion' that has already occurred.
This mechanism make that Mutexes are the best choice for implement mutual exclusion and protect critical sections.
Member Attributes
emaphoreHandle_t _mutexHandler : the FreeRTOS mutex
Member Function Descrition
Mutex()
Description
The constructor of the Mutex. It will create a free RTOS Mutex and initialize it
~Mutex()
Description
The destructor of the Mutex. It will delete the free RTOS Mutex
bool enter(timeSize oTimeToWait)
Description
Obtain the mutex (decrement count value)
Parameters
TimeToWait : maximal amount of time (in ticks) that thread should wait if mutex is not available
bool enterFromISR()
Description
Obtain the semaphore (decrement count value) from an ISR
bool exit()
Description
Release the semaphore (increment count value)
bool exitFromISR()
Description
Release the semaphore (increment count value) from an ISR
bool isCreated()
Description
This function just return true if the mutex has been created successfully, else false.