Multi-threaded use of a file descriptor

Andrew Walrond andrew@walrond.org
Thu Apr 15 22:28:00 GMT 2004


I have a file descriptor (actually a udp socket).

In a multi-threaded environment using a single file descriptor (in this case a 
udp socket), are individual reads/writes guaranteed atomic?

I would like to have one thread reading datagrams from the socket and multiple 
other threads writing datagrams to the same socket.

I can obviously implement a mutex locking scheme to serialize use of the 
socket by the various threads, but is it necessary?

Andrew



More information about the Libc-alpha mailing list