Thread safe read and write for UDP socket

Thread safe read and write for UDP socket

par Emilien Baptiste Baty,
Number of replies: 1

Hi,

I don't understand why (or if) the read and write function of the UDP socket should be thread safe. Indeed, when I studied the implementation of the socket based on channels, I noticed that we locked a mutex while sending and receiving packets. 

But I didn't do that in my UDP socket implementation, and the tests (unit and integration) passed, even with -race. 

So I was wondering if I should still add a mutex to make sure that the read and write function are thread safe ?

Thanks,