Asking for recommendations on good generic asynchronous I/O library

A

alan

Hello all, I'd like to ask recommendations about a "good" generic
asynchronous I/O library for C++. By generic I mean, something I can
use even on files, stdin/stdout, and sockets.

I've seen boost::asio, and also ioxxx, but most of the examples I've
seen with them are about sockets. Can they be used for general i/o
(files, terminal)? Can anyone point me to good tutorials about using
them for stuff other than sockets?

My use case is, I have a set of worker threads in a pool executing
tasks. Every now and then a task may need to perform I/O. If so, the
worker thread initiates the I/O and pushes the task back on the queue
and dequeues a new task. If a worker thread gets a task with pending
I/O, it checks if the I/O is complete, and if it isn't requeues it and
gets a new task, if the I/O is complete is continues with that task.

The reason I'd prefer to handle this case rather than just let the OS
block a thread is when, for some reason, I can only use one worker
thread (e.g. if threads are disabled, or the target doesn't have
threads, etc.). If so the only way I have to simulate multiple tasks
running in parallel would be to use asynchronous I/O on the single
worker thread. I'd rather have the same code to handle both the
single thread case and the multi-thread one, but if there are good
arguments against that I'll reconsider it.

Portability is good, but anything on Linux is OK for me ^^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top