Boost logo

Boost :

Subject: Re: [boost] [filesystem] file monitoring
From: Boris (boriss_at_[hidden])
Date: 2008-10-23 09:21:03

On Thu, 23 Oct 2008 14:45:20 +0200, Carlos Rafael Giani
<e0325834_at_[hidden]> wrote:

> is a file monitor feature planned for boost.filesystem? I have been
> looking for a platform independent solution, but there is none (except
> in toolkits like Qt). Also, so far only inotify (a subsystem in the
> Linux kernel) can tell me when a file is closed after writing, which is
> absolutely necessary when watching a plugins/ directory, for example
> (you don't want to touch the plugins when they're only halfway copied).
> Several tools watch the plugin directory, but don't care if the plugins
> are being written or are fully there already. This can lead to
> instabilities.
> I think it is only logical to add this to boost.filesystem, something
> like set_monitor_callback(pathname, function_object);

I created a directory monitor as a Boost.Asio extension which is used like

boost::asio::io_service io_service;
boost::asio::dir_monitor dir_monitor(io_service);
boost::asio::dir_monitor_event ev = dir_monitor.monitor(); // or:

While I finished the code I didn't have time yet to test it sufficiently.
I hope I can put it online in the coming days.

While my directory monitor is Windows-only a Linux-only directory monitor
is available since August - see The
Linux-only directory monitor is a bit unconventional though as for example
it keeps firing events even if you call async_monitor only once. I'd like
to see one platform-independent directory monitor in the future but would
want to see my Windows-only directory monitor to become stable first.
Anyway I'll post another message in a few days when I put the diretory
monitor online.


Boost list run by bdawes at, gregod at, cpdaniel at, john at