If a task is blocked on a QueueSet what happens if the QueueSet is modified?

If I block a task reading from the QueueSet. What happens if another task adds or removes queues from the set?

I can’t check the code right now, but it is probably ok as queue sets use the standard queue functions.

So, just to be clear. If the other task adds a new queue to the set and then a message gets put on that new queue, the listening task will unblock and receive it?

Thanks for the awesome support by the way!

Oh, I just realised that the QueueSet that my task is blocked on may be getting deleted by another task (I’m using the ESP32 ADF audio event interface esp-adf/audio_event_iface.c at master · espressif/esp-adf · GitHub ). In this case will the blocked task resume with an error return?

If you are talking about this code, it removes all .queues from the queue set before deleting it.

My first thought is this is a sign of a giant race condition. FreeRTOS might handle the deletion of the QueueSet while a task is blocked ono it, but if the delete happened just before the task blocked on the QueueSet, the task would then be using an invalid handle, and nothing can be done there (at least in General).

You should not be destroying shared objects (like a QueueSet) unless you have done something to make sure no one else is able to use them, and do this in a race free manner.

Yes. Thankyou. This is, as usual a problem of a poorly defined and leaky abstraction… I’ll go and read all the relevant ADF code and try to figure out how to use it correctly.