Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About pxHigherPriorityTaskWoken

Tags:

task

freertos

In the description of xSemaphoreGiveFromISR at http://www.freertos.org/a00124.html is written: "From FreeRTOS V7.3.0 pxHigherPriorityTaskWoken is an optional parameter and can be set to NULL."

The question is: If the parameter is NULL and there is higher priority task affected by the semaphore, will it automatically be switched after ISR - without portEND_SWITCHING_ISR( xHigherPriorityTaskWoken )?

like image 832
i486 Avatar asked Feb 13 '26 01:02

i486


2 Answers

If you set the parameter to NULL, the context switch will happen at the next tick (ticks happen each millisecond if you are using the default settings), not immediatlely after the end of the ISR. Depending on your use-case this may be acceptable or not.

like image 111
Étienne Avatar answered Feb 16 '26 20:02

Étienne


No. The purpose of the pxHigherPriorityTaskWokenflag is only to indicate that a context switch is required. Then you need to call portEND_SWITCHING_ISR() or portYIELD_FROM_ISR() in your ISR code in order to request the context switch.

like image 20
stathisv Avatar answered Feb 16 '26 19:02

stathisv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!