# Tick Hook & semaphores

**URL:** <https://forums.freertos.org/t/tick-hook-semaphores/2428>\
**Category:** Kernel\
**Created:** [November 15, 2012, 8:33pm UTC](https://forums.freertos.org/t/tick-hook-semaphores/2428 "2012-11-15T20:33:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 15, 2012, 8:33pm UTC](https://forums.freertos.org/t/tick-hook-semaphores/2428/1 "2012-11-15T20:33:46Z")

</div>

**[jdurand](https://sourceforge.net/u/jdurand/)** wrote on [Thursday, November 15, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/6c134804/#0185):

I often use Tick Hook to operate some low-jitter simple items and items where it’s critical I don’t miss a tick.&nbsp; Nothing that really would require its own task and priority level.

Anyway, no trouble so far on several projects but I just came up with a need to send a semaphore.&nbsp;

I assume I use xSemaphoreGiveFromISR() but do I need to use portEND\_SWITCHING\_ISR(xHigherPriorityTaskWoken) since I’m already in the FreeRTOS interrupt?

Will this even work?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 15, 2012, 10:47pm UTC](https://forums.freertos.org/t/tick-hook-semaphores/2428/2 "2012-11-15T22:47:06Z")

</div>

**[edwards3](https://sourceforge.net/u/edwards3/)** wrote on [Thursday, November 15, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/6c134804/#1b69):

Yes you need to use the FromISR() version, and no you don’t need to worry about the xHigherPriorityTaskWoken variable because a context switch will happen anyway after the tick hook finishes.

In older FreeRTOS versions you would still have to supply the xHigherPriorityTaskWoken parameter, just don’t use it afterwards. In newer FreeRTOS versions you can just pass NULL in place of xHigherPriorityTaskWoken.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 15, 2012, 10:50pm UTC](https://forums.freertos.org/t/tick-hook-semaphores/2428/3 "2012-11-15T22:50:45Z")

</div>

**[jdurand](https://sourceforge.net/u/jdurand/)** wrote on [Thursday, November 15, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/6c134804/#648c):

Thanks!  
I’m still running 7.2.0, will update after this project is closed out, but will assume that’s good enough to use null.
