On Mon, 21 Sep 1998 08:12:26 -0700, Dan Kegel wrote:

>[EMAIL PROTECTED] wrote:
>> The major thing I have done with ioctls() is to do a nonblocking read
>> FIONREAD which also returns the number of bytes available for reading. I
>> could not find a similar function using termios. I can't think of a way
>> to avoid this. (I would actually like to go even lower and use
>> interrupts for notification as the polling is wasteful of resources.)
>
>Would select() be applicable?

Depends on the filehandle.  Serial file handles on some UNIX systems
sometimes block even in non-blocking mode.

>(This is the greatest functions for doing I/O
>efficiently; you can sleep the current thread
>until any of a number of file descriptors has
>i/o ready for you.  Java suffers greatly from
>its absence.  It's the key to implementing 
>truly monsterously high performance web 
>servers and the like, where the number of 
>clients far exceeds the number of available
>threads.)

Actually, I feel that select(), while powerfull, is a great way to
work around the fact that there are thread limits or that, for a long
time, UNIX systems did not have threads.  The Java model is to have
threads be very easy and accessable and, if used in that form, can
simplify the cases of many clients.  Operating systems with no real
thread limit have shown how this can be a major benefit in simplifying
and optimizing such code.

Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz

Reply via email to