|
Boost Users : |
Subject: Re: [Boost-users] [ASIO] directory monitor ASIO extension
From: Boris Schäling (boris_at_[hidden])
Date: 2014-08-05 15:42:09
On Tue, 05 Aug 2014 21:05:30 +0200, Szymon Gatner
<szymon.gatner_at_[hidden]> wrote:
> [...]Version from 2011 is single class and NOT an ASIO extension - there
> is no
> deriving from basic_io_object or io_service::service. Hence my question:
> what is the benefit of deriving from those classes and making your class
> an
> ASIO extension vs 2011 version where io_service is just used "externally"
> for synchronization purposes.
I think the short answer is that you shouldn't derive from basic_io_object
or create your own service unless you have to. :)
Before the I/O object windows::object_handle was added to Boost.Asio,
there was no way to use Windows event objects as there was no code in
Boost.Asio which would call Windows functions like WaitForSingleObject()
or RegisterWaitForSingleObject(). It wouldn't have been possible to reuse
an existing I/O object to add support for event objects. Thus,
windows::object_handle was created which is derived from basic_io_object,
comes with its own service (where those Windows API functions are called)
and integrated pending asynchronous operations into Boost.Asio's event
loop (so Boost.Asio doesn't have to create its own background threads).
It's a perfect fit into Boost.Asio's framework. Today if you ever need to
wait for events asynchronously, you can reuse windows::object_handle and
can ignore the entire framework Boost.Asio set up for I/O objects.
Boris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net