m
m
Line 32: Line 32:
 
|}
 
|}
 
   
 
   
All other APIs required to use the mutex are same as semaphore. You can find them here.
+
All other APIs required to use the mutex are same as semaphore. You can find them [[RTOS Basics : Semaphore|here]].
  
  
  
 
{{DISQUS}}
 
{{DISQUS}}

Revision as of 13:22, 14 April 2015

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 xSemaphoreHandle : It is a handle to the created mutex.

It can be used futher to use other semaphore APIs.

Return Value none
Description It creates the mutex.
Usage

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