[kaffe] unix-pthreads accept timeout
gback at cs.utah.edu
Tue Aug 6 14:41:00 PDT 2002
> Content-Type: text/plain;
> Content-Transfer-Encoding: 8bit
> Im not sure this was a bug or just that Im doing something wrong but in
> kaffe/kaffevm/systems/unix-pthreads/syscalls.c the function jthreadedAccept
> assumes that the fd is O_NONBLOCK. If the fd is blocking the function will
> not go passed the accept syscall and thus never reach the BREAK_IF_LATE macro.
> So what I did is to check if the socket is blocking or not, if its not I let
> it go through the original loop if its blocking I put the fd in a select and
> use the timeout in a timeval struct.
> I attached my modified syscalls.c to this mail
I don't understand what the BLOCK_IF_LATE stuff is doing in
unix-pthreads/syscalls.c. It certainly doesn't work, as you point out.
Maybe it's work in progress (?)
Generally, when you use native threads, you have your file descriptors
in blocking mode. You would implement timed reads (or accepts - though
I don't believe there is a timed accept in Java) using signals.
unix-pthreads/syscalls.c doesn't implement that at this point.
Feel free to add it.
(On a more general note, the interface contract of the jsyscall stuff
is that you don't pass in arbitrary or arbitrarily modded file descriptors,
you pass the fds you get from jthreadedSocket/Open/Accept etc.
A minimum of encapsulation doesn't hurt.)
More information about the kaffe