|
Boost Users : |
Subject: Re: [Boost-users] ASIO file monitoring help
From: Boris Schaeling (boris_at_[hidden])
Date: 2013-04-10 18:34:19
On Wed, 10 Apr 2013 20:43:15 +0200, SRD
<software.research.development_at_[hidden]> wrote:
> [...]Can anyone offer some insight as to how this should work? Any help
> much
> appreciated.
I strongly recommend you to read the tutorial at
<http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/tutorial.html>
or the chapter <http://en.highscore.de/cpp/boost/asio.html> from where you
downloaded the file monitor to get a basic understanding how Boost.Asio is
used.
> [...] boost::asio::io_service io_service;
> boost::asio::dir_monitor dm(io_service);
>
> dm.add_directory("C:\\Users\\SRD\\DirA");
>
> boost::asio::dir_monitor_event ev = dm.monitor();
> dm.async_monitor(create_file_handler);
You should call either monitor() or async_monitor(). The first is a
blocking call, the second an asynchronous call. The call to monitor() only
returns when something happened. If nothing happens monitor() never
returns. async_monitor() returns immediately though. And when something
happens create_file_handler() is called.
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