diff options
author | Colin Walters <walters@verbum.org> | 2010-01-28 16:26:39 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-02-01 16:22:56 -0500 |
commit | 8a9880ffd2b81df38bb0e3492bda7a9636ac0280 (patch) | |
tree | 0e81525a5db40a606a2171ee7880e4a4e0c6a765 /bus/dir-watch.h | |
parent | 0705eb5c869c2f78c57d9c805e1023e8b26b1a06 (diff) | |
download | dbus-8a9880ffd2b81df38bb0e3492bda7a9636ac0280.tar.gz |
Clean up inotify watch handling
Substantially based on a patch by Matthias Clasen <mclasen@redhat.com>
kqueue implementation by Joe Marcus Clarke <marcus@freebsd.org>
Previously, when we detected a configuration change (which included
the set of config directories to monitor for changes), we would
simply drop all watches, then readd them.
The problem with this is that it introduced a race condition where
we might not be watching one of the config directories for changes.
Rather than dropping and readding, change the OS-dependent monitoring
API to simply take a new set of directories to monitor. Implicit
in this is that the OS-specific layer needs to keep track of the
previously monitored set.
Diffstat (limited to 'bus/dir-watch.h')
-rw-r--r-- | bus/dir-watch.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bus/dir-watch.h b/bus/dir-watch.h index 8e322a6e..b44529e5 100644 --- a/bus/dir-watch.h +++ b/bus/dir-watch.h @@ -26,10 +26,15 @@ #ifndef DIR_WATCH_H #define DIR_WATCH_H -/* setup a watch on a directory (OS dependent, may be a NOP) */ -void bus_watch_directory (const char *directory, BusContext *context); - -/* drop all the watches previously set up by bus_config_watch_directory (OS dependent, may be a NOP) */ -void bus_drop_all_directory_watches (void); +/** + * Update the set of directories to monitor for changes. The + * operating-system-specific implementation of this function should + * avoid creating a window where a directory in both the + * old and new set isn't monitored. + * + * @param context The bus context + * @param dirs List of strings which are directory paths + */ +void bus_set_watched_dirs (BusContext *context, DBusList **dirs); #endif /* DIR_WATCH_H */ |