[kaffe] unix-pthreads accept timeout
Godmar Back
gback at cs.utah.edu
Wed Aug 7 08:48:55 PDT 2002
>
>
> --------------Boundary-00=_3FCH8IH134P2HDJJD50M
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 8bit
>
> Well the thing is that it seems to be the same for the vm as it outputs this:
>
> java.io.InterruptedIOException: Accept timed out or was interrupted
>
> when there's a timeout.
>
That's different.
It's referring to Thread.interrupt().
If a thread is interrupted via Thread.interrupt, it should abort an I/O
operation and throw java.io.InterruptedIOException. I believe Sun
never really implemented this (because it's hard to do in Windows),
but we implemented it for jthreads (see jthread_interrupt(),
CALL_BLOCK_ON_FILE).
Conversely, unless there's a timeout, you should only see a
InterruptedIOException if a Thread.interrupt was issued, not if - say - the
thread was interrupted
in the select with EINTR by some random signal. The latter possibility
is what I'm referring to. Now when and if that happens, depends
on Posix signal semantics and the particularities of a particular
pthreads implementation (Linux's pthread deviates from the spec here,
if I recall.) In any event, it's safer and a more conservative
style to assume you're select() can be interrupted for reasons other
than timeout.
Thread.interrupt (as in jthread_interrupt()) is currently not
implemented for pthreads. You can implement it if you like -
possibly using a system, then you must disambiguate the reason
why your select was interrupted on EINTR.
- Godmar
More information about the kaffe
mailing list