[asio] Feature request: console IO
Hello everyone, here is a greeting for joining the list. I want to request console support in asio. Some reasons: 1. non-block stdin is useful for some applications. 2. Linux can do non-block IO on ttys. Implementation concept: 1. Linux: if using epoll, first check if target is a regular file. If not, fall back to threaded non-blocking IO. select(), poll() can be use on any valid fds. 2. Windows: this garbage doesn't support overlapped console IO. Create a separate thread for std{in,out,err}, then communicate with the thread. 3. Other *nix: I don't know. It could already be used through POSIX stream descriptor, but it is too limited and platform specific. A library can cover these gaps is great. I hope you like this idea.
On 2016-03-05 06:12, Tatsuyuki Ishi wrote:
Hello everyone, here is a greeting for joining the list.
I want to request console support in asio.
Some reasons: 1. non-block stdin is useful for some applications. 2. Linux can do non-block IO on ttys.
Implementation concept: 1. Linux: if using epoll, first check if target is a regular file. If not, fall back to threaded non-blocking IO. select(), poll() can be use on any valid fds. 2. Windows: this garbage doesn't support overlapped console IO. Create a separate thread for std{in,out,err}, then communicate with the thread. 3. Other *nix: I don't know.
It could already be used through POSIX stream descriptor, but it is too limited and platform specific. A library can cover these gaps is great.
On Linux at least one can already do console I/O with ASIO. I have written a library to integrate ASIO with readline here: https://github.com/jbytheway/relasio and it works great. I would expect the same code to work on other *nix. But if this case requires special handling on Windows then indeed abstracting this difference sounds like a good case for a Boost library. John Bytheway
On Sun, Mar 6, 2016 at 3:43 AM, John Bytheway
On 2016-03-05 06:12, Tatsuyuki Ishi wrote:
Hello everyone, here is a greeting for joining the list.
I want to request console support in asio.
Some reasons: 1. non-block stdin is useful for some applications. 2. Linux can do non-block IO on ttys.
Implementation concept: 1. Linux: if using epoll, first check if target is a regular file. If not, fall back to threaded non-blocking IO. select(), poll() can be use on any valid fds. 2. Windows: this garbage doesn't support overlapped console IO. Create a separate thread for std{in,out,err}, then communicate with the thread. 3. Other *nix: I don't know.
It could already be used through POSIX stream descriptor, but it is too limited and platform specific. A library can cover these gaps is great.
On Linux at least one can already do console I/O with ASIO. I have written a library to integrate ASIO with readline here:
https://github.com/jbytheway/relasio
and it works great. I would expect the same code to work on other *nix.
But if this case requires special handling on Windows then indeed abstracting this difference sounds like a good case for a Boost library.
John Bytheway
+1
participants (3)
-
charleyb123 .
-
John Bytheway
-
Tatsuyuki Ishi