# Waiting on task notifies and a queue

**URL:** <https://forums.freertos.org/t/waiting-on-task-notifies-and-a-queue/6283>\
**Category:** Kernel\
**Created:** [December 1, 2016, 2:16am UTC](https://forums.freertos.org/t/waiting-on-task-notifies-and-a-queue/6283 "2016-12-01T02:16:25Z")\
**Posts on this page:** 2\
**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:** [December 1, 2016, 2:16am UTC](https://forums.freertos.org/t/waiting-on-task-notifies-and-a-queue/6283/1 "2016-12-01T02:16:25Z")

</div>

**[jgreen](https://sourceforge.net/u/jgreen/)** wrote on [Thursday, December 01, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/abccb3f9/#c984):

The new task notify system seems great and I want to utilize it for fast interrupt to task notifies (with the event group flag mode). However, I’d also like to be able to send/receive queued messages from this same task to other lower priority tasks, for which I’m currently using a queue.

So my question is: how can the task wait on task notifies and the command queue? One thought I have is to just wait on task notifies and create a “RECV\_QUEUE\_CMD” notify event which can be issued by other tasks after posting a message to the command queue. My question is, if there would be any potential race conditions between submitting the mesage to the queue and the task notify? What I mean, is would it be possible for the task notify to occur before the command has been posted to the queue? Or would the sequence of notify, followed by post to queue be atomic in sequence?

Thanks for any info on this.

Best regards,

Element

---

<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:** [December 1, 2016, 5:30pm UTC](https://forums.freertos.org/t/waiting-on-task-notifies-and-a-queue/6283/2 "2016-12-01T17:30:18Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, December 01, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/abccb3f9/#c984/57dd):

Everything will happen sequentially - so if you post to the queue then  
send the notification the message will always be in the queue before the  
notification unblocks the task.

As you are using the “event group flag mode” perhaps you could use one  
of the bits to mean “there is a message in the queue”?
