This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Multi-threaded use of a file descriptor
- From: Andrew Walrond <andrew at walrond dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 15 Apr 2004 23:28:18 +0100
- Subject: Multi-threaded use of a file descriptor
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