While testing the message queue, I tried to set the queue size of 0 in QueueCreate API.
In that case,
a) queue creation was successful.
b) sending the data and receiving the data also successful.After received the data, I checked the xQueueReceive result. xQueueReceive returns pass.
Are we allowing the user to create the queue item size as 0 bytes or initmating the user with error?.
Queue item sizes of 0 are used in the implementation of semaphores, so they don’t report that option as an error, but I can’t see any use for it (other than making the Queue act like a semaphore)
As you have posted several questions on the theme of failure cases, and
I’m not sure how many more you are going to post, I strongly encourage
you to look at and step through the source code to quickly and easily
find the answers to questions such as “what happens if I create a queue
of of size 0” - much faster than posting here and waiting for an answer.
Hi Richard, thanks for the response. Queue item sizes of 0 are used in the implementation of semaphores,
I doesn’t understood the above case, could you explain more about this?
But when I set the queue itemsize as 0, no configassert raised inside receive function?
Hi Richard, thanks for the response.
Queue item sizes of 0 are used in the implementation of semaphores,
I doesn’t understood the above case, could you explain more about this?
But when I set the queue itemsize as 0, no configassert raised inside receive function?
There is no assert in the code to guard against a 0 value of item size, because an item size of 0 is used internally to implement semaphores. Also, just because there is no assert in the code for a condition, doesn’t mean that the condition is ok. The asserts are mainly there to catch the common, hard to find but easy for the code to detect, conditions.
Hi Richard, thanks for the response. Queue item sizes of 0 are used in the implementation of semaphores
I doesn’t understood this case, could you explain more about this or refer any link?