Using Queues with one item

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Using Queues with one item

Postby damithpavithra » Tue Aug 18, 2020 7:39 am

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;

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Re: Using Queues with one item

Postby damithpavithra » Thu Sep 24, 2020 10:19 am

Can anyone please answer this

Thank you

boarchuz
Posts: 605
Joined: Tue Aug 21, 2018 5:28 am

Re: Using Queues with one item

Postby boarchuz » Thu Sep 24, 2020 11:00 am

That's fine, there's even https://www.freertos.org/xQueueOverwrite.html which is intended for single item queues.

damithpavithra
Posts: 13
Joined: Thu Jul 30, 2020 2:40 pm

Re: Using Queues with one item

Postby damithpavithra » Mon Sep 28, 2020 10:05 am

That helps. Thank you

Who is online

Users browsing this forum: No registered users and 112 guests