ESP32 send UDP packets from both cores Im using AsyncUDP in an ESP32 project, where I initialize AsyncUDP udpSender and call udpSender.write(sendbuffer, sendbuffer_size) from both cores, with different buffers on each core.
One core is continually collecting GY-91 (accel/gyro/magnet) sensor data many times a second and sending it via UDP multiple times a second (after every collection), and the other one is collecting some other data like temperature once a second, as well as responding to commands a server sends.
So I'm basically using one sender on both cores and wondering if this is &quot;thread-safe&quot;, if that terminology even applies to this scenario.
Can this cause problems? Is there a specific way this should be done? Like using semaphores?
I don't know if it's thread safe or not. However I would be inclined to play it sage and use a queue and notifications.

Create a queue
Create a &quot;sender&quot; thread that waits for notification then sends anything in the queue through UDP
Create any number of &quot;sensor&quot; threads that place items into the queue then notify the sender thread.