Task 1
- SomeStruct *s = object_pool.allocate();
- s->field = value;
- xQueueSend(xQueue, &s, 0);
- Task 2:
- SomeStruct *s = nullptr;
- xQueueReceive(xQueue, &s, 0)
- object_pool.release(s);
- // and use data pointed to by "s" pointer
If I were coding for x86-64, I would have to make sure that there is sufficient thread safety
in place, either using a queue with a mutex inside or synchronization using atomics, so that
there is a guarantee that the second task sees values in the memory pointed to by
the received pointer.
Is above safe to do on esp32? Thanks.