Amruta (talk) 13:17, 14 April 2015 (IST)


Intro

Mutex is a special type of binary semaphore used for controlling access to the shared resource. It is used to avoid extended priority inversion using priority inheritance technique. Check this to know more about priority inversion.

Priority inheritance can be implemented in two ways : changing the priority of the task trying to access the mutex

  1. to the priority equal to the priority of the task acquiring the mutex or
  2. to the higher priority than the priority of the task acquiring the mutex

so that the task trying to access the mutex will immediately get the mutex when other task releases the mutex.

The first way as adopted in FreeRTOS.

API Details

{{#Widget:LibTable}}
Defination
 vSemaphoreCreateMutex( xSemaphoreHandle xSemaphore )
Input Arguments
xSemaphore : It is a handle to the created mutex. 
It should be of type xSemaphoreHandle
Return Value none
Description
Usage
 

All other APIs required to use the mutex are same as semaphore. You can find them here.