[kaffe] unix-pthreads accept timeout

Mathieu Dube mdube@8d.com
Wed, 7 Aug 2002 09:25:42 -0400


> 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.
well the API's doc of ServerSocket states this:
"setSoTimeout

 public synchronized void setSoTimeout(int timeout) throws SocketException

Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With 
this option set to a non-zero timeout, a call to accept() for this 
ServerSocket will block for only this amount of time."

Plus jthreadedAccept as a timeout passed as an argument. It works perfectly 
in the unix-jthreads version.

> (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.)
Do you mean that I should write a function that waits for the timeout instead 
of having the select() code directly in the jthreadedAccept function?

Thanks
Later
-Mat

-- 
Mathieu Dube -- mdube@8d.com
8D Technologies Inc.
http://www.8d.com