ESP32 send UDP packets from both cores
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.