# How does the system behave if you omit portYIELD\_FROM\_ISR( xHigherPriorityTaskWoken )

**URL:** <https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702>\
**Category:** Kernel\
**Created:** [August 26, 2022, 5:54am UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702 "2022-08-26T05:54:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgarnett](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@rgarnett](https://forums.freertos.org/u/rgarnett)\
**Post date:** [August 26, 2022, 5:54am UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702/1 "2022-08-26T05:54:16Z")

</div>

Hi,

If you **omit** portYIELD\_FROM\_ISR( xHigherPriorityTaskWoken ) from the interrupt handler how does the operating system behave compared to using portYield?

I am guessing if portYield is not used the system returns to the task it was executing when the interrupt occurred rather than the task using the interrupt.

In some cases could this be a good thing to do if the task waiting for the interrupt is low priority and no more interrupts on that line will occur? There are some high priority tasks that I don’t want to switch out of if an interrupt occurs that is serviced by a low priority task.

Regards  
Rob

---

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [August 26, 2022, 6:49am UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702/2 "2022-08-26T06:49:16Z")

</div>

`portYIELD_FROM_ISR` might immediately invoke the scheduler activating the next ready task i.e. the task with the highest prio ready to run. It’s not necessarily the task consuming the event you signaled in the ISR.  
Omitting it just delays the scheduler invocation until the next systick (which might be up to a complete tick period).

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [August 26, 2022, 6:55am UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702/3 "2022-08-26T06:55:13Z")

</div>

@hs2 : all agreed, you just type faster than I do 🙂

I also added this text:

Do not worry about higher-priority tasks: it is not possible to have a lower-priority task running, unless all higher-priority tasks are in a blocked state".  
Tasks with the same priority will share the CPU time, normally swapping at each systick.

---

<div class="post-metadata">

**Author:** ![rgarnett](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@rgarnett](https://forums.freertos.org/u/rgarnett)\
**Post date:** [August 26, 2022, 7:00am UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702/4 "2022-08-26T07:00:28Z")

</div>

Hi HS,

I getit now, thanks.

Regards  
Rob

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [August 26, 2022, 12:45pm UTC](https://forums.freertos.org/t/how-does-the-system-behave-if-you-omit-portyield-from-isr-xhigherprioritytaskwoken/15702/5 "2022-08-26T12:45:50Z")

</div>

The key is that xHigherPriorityTaskWoken won’t get set unless a task with higher priority than the currently running task was woken.
