# xQueueReceive : how to block with xTicksToWai

**URL:** <https://forums.freertos.org/t/xqueuereceive-how-to-block-with-xtickstowai/5001>\
**Category:** Kernel\
**Created:** [January 24, 2006, 3:37pm UTC](https://forums.freertos.org/t/xqueuereceive-how-to-block-with-xtickstowai/5001 "2006-01-24T15:37:47Z")\
**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:** [January 24, 2006, 3:37pm UTC](https://forums.freertos.org/t/xqueuereceive-how-to-block-with-xtickstowai/5001/1 "2006-01-24T15:37:47Z")

</div>

**[ch2](https://sourceforge.net/u/ch2/)** wrote on [Tuesday, January 24, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/dc0cecd3/#e9fd):

I would like to block forever one task using xQueueReceive if it never received data in the queue : what should I put in xTicksToWait?  
Thanks

---

<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:** [January 24, 2006, 3:43pm UTC](https://forums.freertos.org/t/xqueuereceive-how-to-block-with-xtickstowai/5001/2 "2006-01-24T15:43:46Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, January 24, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/dc0cecd3/#e9fd/49dc):

What you have to do is put the call to xQueueReceive into a loop as:

while( !xQUeueReceive( … ) );

using portMAX\_DELAY as the delay period.&nbsp; The while loop will then only exit when data is available.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 24, 2006, 4:17pm UTC](https://forums.freertos.org/t/xqueuereceive-how-to-block-with-xtickstowai/5001/3 "2006-01-24T16:17:05Z")

</div>

**[ch2](https://sourceforge.net/u/ch2/)** wrote on [Tuesday, January 24, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/dc0cecd3/#e9fd/becc):

thanks for your quick & precise answer.  
I have another question :  
I receive data on the HDLC port from the STR710 and during the IRQ HDLC I’m storing this data one byte after another one int the queue. And I have one task which is waiking up when there is data in the queue : will this task wake up after the irq wrote 1 byte in the queue or at the end of the IRQ?  
Thanks  
chris
