Page 1 of 1

Using Queues with one item

Posted: Tue Aug 18, 2020 7:39 am
by damithpavithra
HelloI am new to ESP32 and freeRTOS.
I use queues to sync two tasks. For that i use a sending and receving queues with
exactly one item. item can be anything eg: struct, integer, bool etc.
my synced task flow is like this.

task1

do something

send queue1

task1wait for queue2


task2
wait for queue1

receive queue1

do something

send queue2

task1
receve queue2

continue task1

Please assume that there is no deadlock scenario .
Tasks seems to be work fine.
But my problem is, In every free RTOS queue example i saw, queues were defined with more than one item.
Eventhough only one item is required still they used 2 or 3 items in a queue.
Why there is more than one item.
Are there any pitfalls of using one quque item.

Thank you;

Re: Using Queues with one item

Posted: Thu Sep 24, 2020 10:19 am
by damithpavithra
Can anyone please answer this

Thank you

Re: Using Queues with one item

Posted: Thu Sep 24, 2020 11:00 am
by boarchuz
That's fine, there's even https://www.freertos.org/xQueueOverwrite.html which is intended for single item queues.

Re: Using Queues with one item

Posted: Mon Sep 28, 2020 10:05 am
by damithpavithra
That helps. Thank you