Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


API for xSemaphoreGetMutexHolder

Posted by amomum on June 19, 2015

There is an API function xSemaphoreGetMutexHolder. For some reason, on the API page http://www.freertos.org/xSemaphoreGetMutexHolder.html return type is missing.

So I looked in the source code and saw that xSemaphoreGetMutexHolder is actually a macro for xQueueGetMutexHolder. And xQueueGetMutexHolder returns "void *" although it's prefix (x) should mean something else.

I'm not entirely sure what does x-prefix mean but every other functions that return "void *" are prefixed with "pv".

After reading API reference I figured out that it actually should return TaskHandle_t (which is a typedef for void *).

Although this is not a bug I'm not sure it's as it should be.


Return type is also missing in API references for xSemaphoreTake, xSemaphoreTakeFromISR, xSemaphoreTakeRecursive, xSemaphoreGive, xSemaphoreGiveRecursive and xSemaphoreGiveFromISR.

API for xSemaphoreGetMutexHolder

Posted by rtel on June 19, 2015
Thanks for pointing out the missing return type 
in the documentation - it has been corrected.

I suspect the function returns a void* because 
inside the queue.c the TaskHandle_t type is not 
known - and it can't be relied upon that an 
application writer will include task.h before 
queue.h.  Returning void* is ok as it can be cast 
to any type, and in this case TaskHandle_t is itself 
a void * - hence I have updated the documentation to 
show a TaskHandle_t being returned.


[edited to remove formatting as the forum uses the asterisk as a formatting character.]

API for xSemaphoreGetMutexHolder

Posted by amomum on June 19, 2015

I presume, including task.h inside queue.h is not acceptable? Then, I guess, it's okay.

As far as I can see, you didn't update API references for other functions that I mentioned.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists