[433] in Pthreads mailing list archive
Re: question about fd sharing
daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Sep 30 14:00:41 1996
To: "Larry V. Streepy, Jr." <streepy@healthcare.com>
Cc: pthreads@MIT.EDU
In-Reply-To: Your message of "Mon, 30 Sep 1996 11:33:28 MDT."
<32500468.B5DF4D3@healthcare.com>
Date: Mon, 30 Sep 1996 13:42:42 EDT
From: Greg Hudson <ghudson@MIT.EDU>
> Are fd's shared by all threads by default or is there some operation
> you can perform to make them shared?
They are shared.
> 1. Create a thread to listen on a socket.
> 2. When a connection is accepted, create another thread to handle
> the reading and another to handle the writing.
> The initial thread sets the socket to non-blocking prior to the
> creation of the reader and writer threads. However, the socket
> appears to be blocking when a recv is performed in the reading
> thread.
There may be a bug in the MIT Pthreads library regarding non-blocking
file descriptors, since MIT Pthreads uses the non-blocking flag for
its own purposes (it attempts to recognize the application setting the
socket non-blocking, but there could be a bug). Unfortunately, I
don't have time to look into it right now.