# vTaskSuspend()

**URL:** <https://forums.freertos.org/t/vtasksuspend/5471>\
**Category:** Kernel\
**Created:** [February 20, 2009, 9:54pm UTC](https://forums.freertos.org/t/vtasksuspend/5471 "2009-02-20T21:54:39Z")\
**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:** [February 20, 2009, 9:54pm UTC](https://forums.freertos.org/t/vtasksuspend/5471/1 "2009-02-20T21:54:39Z")

</div>

**[fkln](https://sourceforge.net/u/fkln/)** wrote on [Friday, February 20, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/edc6670a/#8d5f):

I am working with STM32 and GCC. My program have several tasks which communicate with two Queues, a Counting Semaphore and a Mutex. For debugging, I have implemented some of the Trace Hook Macros.

If I do a xQueueReceive(RxQueue, &value, portMAX\_DELAY) to an empty queue, I see that the traceTASK\_SUSPEND() macro is active in the actual running task and&nbsp; that this task is restarted at the beginning again.

Is this possible / correct ?

---

<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:** [February 21, 2009, 2:26pm UTC](https://forums.freertos.org/t/vtasksuspend/5471/2 "2009-02-21T14:26:18Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Saturday, February 21, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/edc6670a/#8d5f/7dc7):

I can understand that this would be unexpected, but it is actually correct.

When a task wants to block indefinitely it is actually placed onto the suspended list rather than a blocked list - this is because tasks on the blocked list must have a timeout.&nbsp; Even thought the suspended list is used, the task is in the Blocked state not the Suspended state.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 22, 2009, 9:48am UTC](https://forums.freertos.org/t/vtasksuspend/5471/3 "2009-02-22T09:48:46Z")

</div>

**[fkln](https://sourceforge.net/u/fkln/)** wrote on [Sunday, February 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/edc6670a/#8d5f/7c10):

With your explanation the program is now running.

The problem was, that I have taken a Mutex and later I was receiving characters with xQueueReceive(RxQueue, &value, portMAX\_DELAY) in the same task. Because the queue was still waiting of more values, the task was suspended and the mutex was lost forever. Perhaps you can add this hint to your FreeRTOS eBook.

Thanks,

Klaus.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 22, 2009, 11:02am UTC](https://forums.freertos.org/t/vtasksuspend/5471/4 "2009-02-22T11:02:36Z")

</div>

**[fkln](https://sourceforge.net/u/fkln/)** wrote on [Sunday, February 22, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/edc6670a/#8d5f/96d7):

With your explanation the program is now running.

The problem was, that I have taken a Mutex and later I was receiving characters with xQueueReceive(RxQueue, &value, portMAX\_DELAY) in the same task. Because the queue was still waiting of more values, the task was suspended and the mutex was lost forever. Perhaps you can add this hint to your FreeRTOS eBook.

Thanks,

Klaus.
