#include <FileWatcher.h>
Public Member Functions | |
CFileWatcher (CIoCompletionThreadPool &ioCompletionPool) | |
Construct a file watcher object that uses the given thread pool. | |
~CFileWatcher () | |
Destruct a file watch object. | |
void | cancel () |
Cancel all watches. | |
void | startWatch (CFileWatch *watch, DWORD changesMask=FILE_NOTIFY_CHANGE_LAST_WRITE|FILE_NOTIFY_CHANGE_FILE_NAME) |
Start a watch. | |
void | stopWatch (CFileWatch *watch) |
Stop a watch. | |
Friends | |
class | CFileWatchSet |
Termination is a three step process since we don't own the thread pool. Firstly, you should call cancel(). This ensures that all watch objects complete which causes them to tidy themselves up.
Secondly, you should shutdown your thread pool. This is because there may be outstanding posted changed notifications that need to be cleaned up. Posting a notification to the thread pool to encourage the thread to quit will take care of this.
Finally, it is safe to delete the file watcher object. It is fine for this object to be a global (although construction may throw std::bad_alloc).
|
Construct a file watcher object that uses the given thread pool.
|
|
Start a watch.
|
|
Stop a watch.
|