3

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 )?

i486
  • 6,491
  • 4
  • 24
  • 41

2 Answers2

3

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.

Étienne
  • 4,773
  • 2
  • 33
  • 58
2

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.

stathisv
  • 489
  • 2
  • 7