Hello,
I observe strange behavior but I first let me describe the situation with some pseudo code
QueueHandle_t q1;
QueueHandle_t q2;
QueueSetHandle_t set;
void foo()
{
xQueueSend(task2_queue, 0);
//do something
xQueueReceive(q2, 1000 ticks); // wait for response from task2
// Here is THE PLACE were magic happens :)
}
void task1(void *param)
{
q1 = xQueueCreate(SIZE, sizeof(some_struct));
q2 = xQueueCreate(SIZE, sizeof(some_struct));
set = xQueueCreateSet(2 * SIZE);
xQueueAddToSet(set, q1);
xQueueAddToSet(set, q2);
QueueHandle_t queue;
while(1) {
queue = (QueueHandle_t) xQueueSelectFromSet(set, 50);
if (queue == q2) {
// do something
}
foo();
}
}
When I wait for queue q2 in function foo() the execution time of xQueueReceive is always 1000 ticks despite the fact that that the message arrived earlier.
The strange thing is when I remove q2 from QueueSet receive in foo() execute immediate after something is in queue.
I did some measurements with the test code and when q2 is added to QueueSet execution of xQueueReceive in foo() is always 1000 ticks, but when q2 is not added to QueueSet is execution of xQueueReceive is 200 ticks.
I have no idea what is going on :).
Any help is welcome
Thanks.