xSemaphoreTakeFromISR is only used within FreeRTOS.
 
Symbols
loading...
Files
loading...

xSemaphoreTakeFromISR macro

Macro to take a semaphore from an ISR. The semaphore must have previously been created with a call to xSemaphoreCreateBinary() or xSemaphoreCreateCounting(). Mutex type semaphores (those created using a call to xSemaphoreCreateMutex()) must not be used with this macro. This macro can be used from an ISR, however taking a semaphore from an ISR is not a common operation. It is likely to only be useful when taking a counting semaphore when an interrupt is obtaining an object from a resource pool (when the semaphore count indicates the number of resources available).

Syntax

#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )

Arguments

xSemaphore

A handle to the semaphore being taken. This is the handle returned when the semaphore was created.

pxHigherPriorityTaskWoken

xSemaphoreTakeFromISR() will set *pxHigherPriorityTaskWoken to pdTRUE if taking the semaphore caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If xSemaphoreTakeFromISR() sets this value to pdTRUE then a context switch should be requested before the interrupt is exited.

Return value

pdTRUE if the semaphore was successfully taken, otherwise pdFALSE

References

LocationText
semphr.h:658
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
cmsis_os.c:648
if (xSemaphoreTakeFromISR(mutex_id, &taskWoken) != pdTRUE) {
cmsis_os.c:801
if (xSemaphoreTakeFromISR(semaphore_id, &taskWoken) != pdTRUE) {