# Is it advisable use an API ended in FromISR from a task context?

**URL:** <https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886>\
**Category:** Kernel\
**Created:** [July 4, 2024, 2:08pm UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886 "2024-07-04T14:08:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmrivas70](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jmrivas70](https://forums.freertos.org/u/jmrivas70)\
**Post date:** [July 4, 2024, 2:08pm UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886/1 "2024-07-04T14:08:31Z")

</div>

Hello

I am porting am application which runs on VxWorks to FreeRTOS.

It is quite big.

The thing, it is that VxWorks can tell you in which context code is running (ISR vs task), but AFIK FreeRTOS does not provide that functionality.

In order to save some work, we are considering if the fact of using xSemaphoreGiveFromISR from a task could have some side-effects in the execution.

Documentation states clearly not to do the other way round.

Thanks in advance for you time.

Best regards,  
Jose

---

<div class="post-metadata">

**Author:** ![RAc](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rac/32/1389_2.png) [@RAc](https://forums.freertos.org/u/RAc)\
**Post date:** [July 4, 2024, 2:38pm UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886/2 "2024-07-04T14:38:09Z")

</div>

This has been discussed here several times before, eg here:

[FromISR from user space - Kernel - FreeRTOS Community Forums](https://forums.freertos.org/t/fromisr-from-user-space/8752)

You may want to use the search function to avoid redundant discussions.

Thanks!

---

<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:** [July 4, 2024, 8:54pm UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886/3 "2024-07-04T20:54:44Z")

</div>

In addition on Cortex-M MCUs there is `xPortIsInsideInterrupt()` to check the context.

---

<div class="post-metadata">

**Author:** ![jmrivas70](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jmrivas70](https://forums.freertos.org/u/jmrivas70)\
**Post date:** [July 5, 2024, 7:52am UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886/4 "2024-07-05T07:52:16Z")

</div>

Thank you for your reply.

Reply.

---

<div class="post-metadata">

**Author:** ![jmrivas70](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jmrivas70](https://forums.freertos.org/u/jmrivas70)\
**Post date:** [July 5, 2024, 7:53am UTC](https://forums.freertos.org/t/is-it-advisable-use-an-api-ended-in-fromisr-from-a-task-context/20886/5 "2024-07-05T07:53:38Z")

</div>

I saw it after I wrote this post.

Although we are porting to a SoC under development. It´s a R&D project.

Thank you.
