[435] in Pthreads mailing list archive
fd sharing and non-blocking
daemon@ATHENA.MIT.EDU (Larry V. Streepy, Jr.)
Mon Sep 30 14:29:34 1996
Date: Mon, 30 Sep 1996 12:03:37 -0600
From: "Larry V. Streepy, Jr." <streepy@healthcare.com>
To: pthreads mailing list <pthreads@MIT.EDU>
I think I may have answered my own question.
After rooting around in the fd code, I noticed that the recv_timedwait
function checks the __FD_NONBLOCK flag on the fd table entry. Now, this
flag is always set in the "open" call, but is not set in the "socket"
call (although the underlying kernel fd is marked as non blocking).
So, later in the recv call, the kernel thinks its non-blocking and the
pthreads routines don't, so they drop into a wait instead of returning
-1 and errno == EAGAIN (or whatever your kernel returns).
I think the solution is to have the "ioctl" wrapper understand FIONBIO
calls and properly set the __FD_NONBLOCK flag accordingly.
Any objections?
Another question: Am I the first person to really hammer on the pthreads
package socket support? I've uncovered a lot of bugs and I was
wondering if anybody else was seeing these problems, are you working on
fixes just like me, are there patches I should be aware of?
Thanks.
--
Larry V. Streepy, Jr.
Chief Technical Officer, Healthcare Communications, Inc.
mailto:streepy@healthcare.com
(214) 851-7033 (Dallas Main #)
(970) 626-5028 (My office #) (970) 626-4425 (Fax)