Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Chaining the higherPriorityTaskWoken variable

Posted by Paul Coleman on March 14, 2012
I have a situation where I'm responding to a number of GPIO interrupts with one ISR and I just want to clarify that I'm using the correct method of dealing with the situation whereby a higher priority task will be woken as a result of this interrupt.

Looking at the source code for xSemaphoreGiveFromISR() it looks as though it's okay to chain the use of the variable higherPriorityTaskWoken as shown below as opposed to creating separate variables for each call to xSemaphoreGiveFromISR and then bitwise oring them together to create the final return value which is passed into the portEND_SWITCHING_ISR macro e.g.

portBASE_TYPE higherPriorityTaskWoken = pdFALSE; // only set its initial value once

if(some event)
xSemaphoreGiveFromISR(semA, &higherPriorityTaskWoken); // using the variable here

if(some other event)
xSemaphoreGiveFromISR(semB, &higherPriorityTaskWoken); // and the same one here again

if(some other event)
xSemaphoreGiveFromISR(semC, &higherPriorityTaskWoken); // and here again


I would be grateful if somebody could just clarify that the above is correct.

Many thanks, Paul.

RE: Chaining the higherPriorityTaskWoken variable

Posted by Richard on March 14, 2012
Yes your code is fine.

[I caused a bit of confusion on this maybe in my reply to a recent post]


RE: Chaining the higherPriorityTaskWoken variable

Posted by Paul Coleman on March 14, 2012
Okay thanks for the clarification, it makes the code a lot cleaner than having separate variables and I'm all for that :)

Regards, Paul.

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner