(Created page with "category: RTOS Tutorials ~~~~ ---- ==Intro== Mutex is a special type of binary semaphore used for controlling access to the shared resource. It is used to avoid extended...")
 
m
Line 20: Line 20:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||<syntaxhighlight  lang = "c"> vSemaphoreCreateMutex( xSemaphoreHandle xSemaphore )</syntaxhighlight>
+
|Defination ||vSemaphoreCreateMutex( xSemaphoreHandle xSemaphore )
 
|-
 
|-
| Input Arguments ||<syntaxhighlight  lang = "c">xSemaphore : It is a handle to the created mutex.  
+
| Input Arguments ||xSemaphoreHandle : It is a handle to the created mutex.
It should be of type xSemaphoreHandle</syntaxhighlight>
+
It can be used futher to use other semaphore APIs.
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description || <br />
+
| Description || It creates the mutex.
 
|-
 
|-
| Usage ||<syntaxhighlight  lang = "c"></syntaxhighlight>
+
| Usage ||
 
|}
 
|}
 
   
 
   

Revision as of 13:20, 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.