Boost logo

Boost :

Subject: Re: [boost] [asio] Feature request: console IO
From: John Bytheway (jbytheway+boost_at_[hidden])
Date: 2016-03-06 06:43:09


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk