# Block time in gatekeeper example 16 from book

**URL:** <https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373>\
**Category:** Kernel\
**Created:** [June 11, 2011, 1:11pm UTC](https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373 "2011-06-11T13:11:18Z")\
**Posts on this page:** 4\
**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:** [June 11, 2011, 1:11pm UTC](https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373/1 "2011-06-11T13:11:18Z")

</div>

**[anguel78](https://sourceforge.net/u/anguel78/)** wrote on [Saturday, June 11, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c089c4c5/#6129):

Hi!

Looking at example 16 in the book there is the prvPrintTask() function which is used to send strings to the gatekeeper task. This task uses xQueueSendToBack() with a block time of 0. The comments say that this block time is used because there should always be space in the queue. But I am not sure that this is safe (especially to use it in an example), because both prvPrintTask() instances have priorities higher than the gatekeeper task and use random blocking delays. Additionally there is an ISR also writing to the queue. Maybe it is unlikely that all delays happen to be very short 5 consecutive times (5 is the size of the queue), but on the other hand the gatekeeper uses printf which takes a lot of time so IMHO the queue may become full because the low priority gatekeeper may not get the chance to always empty the queue in time and if it was another type of application - queuing important items to the queue may fail. Or do I misunderstand something?

Regards,  
Anguel

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 11, 2011, 1:35pm UTC](https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373/2 "2011-06-11T13:35:37Z")

</div>

**[anguel78](https://sourceforge.net/u/anguel78/)** wrote on [Saturday, June 11, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c089c4c5/#84ad):

Sorry, in the post above of course I wanted to say that prvPrintTask() uses xQueueSendToBack() with a block time of 0.

---

<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:** [June 11, 2011, 5:10pm UTC](https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373/3 "2011-06-11T17:10:04Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Saturday, June 11, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c089c4c5/#5008):

I think your analysis is in fact accurate.&nbsp; While it is unlikely that the queue would become full, it is definitely not impossible.&nbsp; Probably the comment should be edited.&nbsp; In the example, posts to the queue that are not successful may pas unnoticed as the return value of the queue send function is not checked.

Thanks for pointing this out.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 11, 2011, 7:26pm UTC](https://forums.freertos.org/t/block-time-in-gatekeeper-example-16-from-book/4373/4 "2011-06-11T19:26:06Z")

</div>

**[anguel78](https://sourceforge.net/u/anguel78/)** wrote on [Saturday, June 11, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c089c4c5/#2f99):

Thanks for the reply Richard!

I am happy that I have understood how FreeRTOS works, at least in theory 😉

Best regards,  
Anguel
