Using portEND_SWITCHING_ISR with soft timers

Hi,
my understanding is that to return immediately, you need to use portEND_SWITCHING_ISR with every function that ends with “FromISR”. That includes software timers functions like xTimerStartFromISR()? Or just with task notification ones such as xTaskNotifyFromISR()?

Thank you :slight_smile:

It’s obviously not related to the particular function e.g. timers or notifications. Instead it’s a basic (scheduling) optimization mechanism of (certain ports of) FreeRTOS. You’’ll notice the pxHigherPriorityTaskWoken argument of a number of FromISR API calls to be paired with portEND_SWITCHING_ISR.

1 Like

Thank you Hartmut :slight_smile:

Any FromISR routine that takes the pointer to a ‘wasWoken’ flag will have the capability to wake up a blocked task (otherwise it wouldn’t the the parameter). All these functions can share a given wasWoken flag, and generally at the end of the ISR would have a portEND_SWITCHING_ISR call.

In particular, your question about software timers, most calls relating to timers actual push an action code on a queue that the TimerTask is waiting for, so they may well need to schedule a new task.