Non-blocking input on windows, like select in Unix
Jonathan Fine
jfine at pytex.org
Wed Mar 2 02:22:50 EST 2005
Paul Rubin wrote:
> Jonathan Fine <jfine at pytex.org> writes:
>
>>My question is this: Under Windows, is it possible
>>to read as many bytes as are available from stdout,
>>without blocking?
>
>
> I think Windows implements non-blocking i/o calls. However the
> traditional (to some) Python or Java approach to this problem is
> to use separate threads for the reader and writer, and let them block
> as needed.
Thank you for this.
As I recall, some posts to this list say that Windows provides
non-blocking i/o for sockets but not for files.
However, if non-blocking i/o for files were available, that
would be great. Actually, all I care about is input.
Can anyone provide a definite answer to this question?
And please, if the answer is YES (hope it is), with
working sample code.
The threaded approach does not help me. If the read blocks,
I do not know what to write. (I am responding to a command
line prompt - I have to read it first.)
--
Jonathan
More information about the Python-list
mailing list