select.select() on Regular Files?

Jim Dennis jimd at vega.starshine.org
Sun Mar 17 19:18:32 EST 2002


In article <a67d2n$2kp$1 at verence.demon.co.uk>, Paul Wright wrote:
>In article <a678ud$30dv$1 at news.idiom.com>,
>Jim Dennis <jimd at vega.starshine.org> wrote:

>> O.K. so what can I do for asynchronous I/O notification on 
>> regular files?  How can I efficiently block and wake up when
>> I/O is available on any of my file descriptors?  

>> Don't tell me I have to go into a sleep and poll stat() or
>> seek() loop!  It's hard to imagine that UNIX got this far 
>> without offering a better solution than that!

> If you run strace on "tail -f somefile", you'll find that sleeping and
> stat'ing is what it's doing, so I don't think there's a better way.

> Paul Wright | http://pobox.com/~pw201 |

 Alright, I'll 'fess up.  I had run strace tail -f ... before I wrote
 my original post.  But I was hoping that I was looking at some 
 legacy of compatibility/portability, or laziness!

 I guess the newer versions of FreeBSD are ahead of Linux in this
 category.  Hopefully Ben LaHaise' AIO work will get merged in soon
 and in a few years we can relegate "while (1) { nanosleep(); stat(); }"
 to the history books.
 




More information about the Python-list mailing list