[asio] Custom asynchronous service
Hi all, I would like to adapt my class to asio for offering async_do_something(param, callback) interfaces. After reading examples presented in asio/examples/services/ and some asio source code. I found the example does not do invoke callback stuff (e.g. asio/examples/service/logger_service.cpp). In case of asio source code, there are classes such as detail::wait_handler<> that wrap user callbacks for invoked later. Should I use these wrappers in my service implementation if I hope to comfort the strand design of asio? Do I have other choices? All suggestions are welcome. Best wishes, Acer.
On Tue, 02 Oct 2012 10:24:59 +0200, Acer Yang
Hi all,
I would like to adapt my class to asio for offering async_do_something(param, callback) interfaces. [...]Do I have other choices? All suggestions are welcome.
I'm not entirely sure what you are trying to do. But maybe this helps a bit: I explained at http://en.highscore.de/cpp/boost/asio.html#asio_extensions how to create your own Boost.Asio I/O service. I also gave a presentation once about the different possibilities - see https://github.com/boostcon/2011_presentations/raw/master/wed/creating_boost.... Boris
On Wed, Oct 3, 2012 at 5:54 AM, Boris Schaeling
On Tue, 02 Oct 2012 10:24:59 +0200, Acer Yang
wrote: Hi all,
I would like to adapt my class to asio for offering async_do_something(param, callback) interfaces. [...]Do I have other choices? All suggestions are welcome.
I'm not entirely sure what you are trying to do. But maybe this helps a bit: I explained at < http://en.highscore.de/cpp/boost/asio.html#asio_extensions> how to create your own Boost.Asio I/O service. I also gave a presentation once about the different possibilities - see < https://github.com/boostcon/2011_presentations/raw/master/wed/creating_boost...
.
Boris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
That's actually what I need! Your talk is also very helpful. Thank you! Best wishes, Acer.
On Wed, Oct 3, 2012 at 5:54 AM, Boris Schaeling
On Tue, 02 Oct 2012 10:24:59 +0200, Acer Yang
wrote: Hi all,
I would like to adapt my class to asio for offering async_do_something(param, callback) interfaces. [...]Do I have other choices? All suggestions are welcome.
I'm not entirely sure what you are trying to do. But maybe this helps a bit: I explained at < http://en.highscore.de/cpp/boost/asio.html#asio_extensions> how to create your own Boost.Asio I/O service. I also gave a presentation once about the different possibilities - see < https://github.com/boostcon/2011_presentations/raw/master/wed/creating_boost...
.
Boris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Boris, Following your example, I have written my own extension. I found that when I register signal handler for shutdown my application manually, the application required ctrl-C twice to be shutdown. Then I go back to check the example, adding the same signal handler - it acted the same way. Should I book all io_service(s) for stop them externally? Here is a the example modified that uses sleep() rather than Windows API. http://gais4.cs.ccu.edu.tw/~yangacer/asio_ext.tar.gz Best wishes, Acer.
participants (2)
-
Acer Yang
-
Boris Schaeling