This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]