Nonblocking IO for stdin
gareis
dhasenan at gmail.com
Mon Jan 8 18:53:32 PST 2007
So I modified Phobos somewhat so I could make a socket to associate with
stdin and thereby see if there was any input ready. There were two
problems with this: first, there was a false positive upon starting the
program, so it hanged for input; second, it did not acknowledge any
further keyboard input.
The only solution I see currently is to use threads. That should be
relatively safe, given that the input thread should never need to
interact with the output thread. I hope.
gareis wrote:
> Sorry, I accidentally posted this to .D rather than to .learn. I begin
> to think I never will.
>
> I'm looking for nonblocking input from stdin. Every input function for
> streams blocks, and din.available() always returns 0.
>
> I can do this with a socket, but I don't know how to open a socket for
> stdin.
>
> Any suggestions of where to look? I haven't found anything in the
> archives about it.
>
> Thanks.
More information about the Digitalmars-d-learn
mailing list