Avoid busy loop when waiting for input on stdin. (#3127)
Avoid busy loop when waiting for input on stdin. (#3127)

* Avoid busy loop when waiting for input on stdin.

This affected a program of mine which implemented a server waiting for input on stdin. The actor Stdin was spawned with '_use_events=false' and thus using a busy loop to read from stdin. This mode is suitable, when stdin is a redirected file like in './pony_program < inputfile.txt', but does not make sense when listening for spare input. 1 CPU was at 100% all the time while the program did nothing and received nothing.

The proposed solution is to only **not** use asio events to wait for data to be available when stdin can be detected to be a file.

* switch -> if

cquinn/ponyc,ponylang/ponyc,sgebbie/ponyc,ponylang/ponyc,sgebbie/ponyc,ponylang/ponyc,cquinn/ponyc,kulibali/ponyc,dipinhora/ponyc,jemc/ponyc,sgebbie/ponyc,jemc/ponyc,sgebbie/ponyc,dipinhora/ponyc,sgebbie/ponyc,kulibali/ponyc,cquinn/ponyc,kulibali/ponyc,kulibali/ponyc,dipinhora/ponyc,jemc/ponyc,cquinn/ponyc