-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow using wrappers around custom dispatchers #60
Comments
This allows someone with a file-descriptor based interface to select on their file descriptor in their main dispatcher, and make this plugin set their file descriptor dirty (write to it) whenever the main dispatcher needs to be woken up. Caveat: This does not help with remote connections at all, since this plugin cannot do anything when there's data on io_service via the boost socket. Closes daniele77#60.
Actually while attempting to fix this, I realized that this won't be a very holistic solution. Basically, any such approach will be helpless when it comes to network data on boost sockets. It appears that boost does not take kindly to other dispatchers trying to do its job ( :sad: ). Until then, I have adopted a different approach for this, where I launch one thread with an |
First of all, are you sure boost asio can’t manage file descriptors? Take a look at this page: Sorry, but I can’t understand the problem you’re trying to solve in the first place. Cli handlers all run in the thread that invokes run() on the io_service passed on the cli constructor. |
Gist:
My particular use-case requires using a custom event dispatcher that selects on file descriptors. I spent a lot of time trying to make that happen with
boost::asio::io_service
, and concluded that it can't be done (correct me if I'm wrong).So I'm proposing something different. Allow passing a custom wrapper type instead of
boost::asio::io_service
to the CliLocalTerminalSession and other objects. This can be done via a template argument defaulting toio_service
, or it can be done by expecting a virtual interface that can be pre-implemented forio_service
in a helper header.I can pick this up myself as well when I get time, if there are no objections to the direction.
Basically what I would like to do in my custom wrapper interface / type is: I would make a pipe file descriptor dirty before actually calling
Post
on the io_service. In my main thread, the dispatcher would be callingselect
on the other end of the pipe (another file descriptor). It would then callpoll
on theio_service
.The text was updated successfully, but these errors were encountered: