# vTaskNotifyGiveFromISR() called not from an ISR

**URL:** <https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922>\
**Category:** Kernel\
**Created:** [March 8, 2021, 2:12pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922 "2021-03-08T14:12:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rik001](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rik001](https://forums.freertos.org/u/Rik001)\
**Post date:** [March 8, 2021, 2:12pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/1 "2021-03-08T14:12:15Z")

</div>

Hi,  
some basic questions:  
is vTaskNotifyGiveFromISR() faster than vTaskNotifyGive() ?

Can I call vTaskNotifyGiveFromISR() from outside an interrupt or are there other risks and should use vTaskNotifyGive()?

I assume I can wake the same task from multiple points in the code using vTaskNotifyGiveFromISR() in one part of the code and vTaskNotifyGive() in another. Correct?

Thank you:)

---

<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:** [March 8, 2021, 2:29pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/2 "2021-03-08T14:29:02Z")

</div>

> [@Rik001](#):
>
> Can I call vTaskNotifyGiveFromISR() from outside an interrupt or are there other risks and should use vTaskNotifyGive()?

There is a reason that there are 2 dedicated functions. I’d use them as documented.  
Or which bigger problem do you want to solve ?

---

<div class="post-metadata">

**Author:** ![Rik001](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rik001](https://forums.freertos.org/u/Rik001)\
**Post date:** [March 8, 2021, 3:36pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/3 "2021-03-08T15:36:19Z")

</div>

Yes, I was going to use them as suggested/designed to be used. I was just wondering whether the ISR one was faster.

The main question is whether I can wake the same task put in wait state by vTaskNotifyTake() form multiple vTaskNotifyGive() and vTaskNotifyGiveFromISR(). Which from what I have been reading seems to be the case but in a couple of forums it was confusing. Hence my question.

Thank you 🙂

---

<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:** [March 8, 2021, 3:54pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/4 "2021-03-08T15:54:47Z")

</div>

Yes - you can invoke vTaskNotifyGive(FromISR) from multiple tasks/ISRs.  
The difference of the `FromISR` variants is that they internally take care about being called in ISR context which is different to a task context. It’s completely unrelated to execution speed.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 8, 2021, 4:20pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/5 "2021-03-08T16:20:16Z")

</div>

In general, the FromISR versions are faster because there is less logic in them. See [https://www.freertos.org/FAQ\_API.html#IQRAPI](https://www.freertos.org/FAQ_API.html#IQRAPI) - although that is less true for the TaskNotify()/TaskNotifyFromISR functions as they do not have lists of tasks waiting to send or waiting to receive so there is less logic in them anyway.

If the port you are using supports interrupt nesting (such as the Cortex-M, RX, PIC32, etc. ports do), then it is safe to call the FromISR functions from a task. If the port doesn’t support interrupt nesting then it is not safe because portSET\_INTERRUPT\_MASK\_FROM\_ISR() and portCLEAR\_INTERRUPT\_MASK\_FROM\_ISR() are not implemented so you do not have thread safey.

---

<div class="post-metadata">

**Author:** ![Rik001](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rik001](https://forums.freertos.org/u/Rik001)\
**Post date:** [March 8, 2021, 4:47pm UTC](https://forums.freertos.org/t/vtasknotifygivefromisr-called-not-from-an-isr/11922/6 "2021-03-08T16:47:28Z")

</div>

Thank you both for the clarification.
