Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OW32::CFileWatcher Class Reference

This class watches file watch objects and invokes the callbacks when they change. More...

#include <FileWatcher.h>

List of all members.

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


Detailed Description

This class watches file watch objects and invokes the callbacks when they change.

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).


Constructor & Destructor Documentation

OW32::CFileWatcher::CFileWatcher CIoCompletionThreadPool ioCompletionPool  ) 
 

Construct a file watcher object that uses the given thread pool.

Parameters:
ioCompletionPool The i/o completion thread pool


Member Function Documentation

void OW32::CFileWatcher::startWatch CFileWatch watch,
DWORD  changesMask = FILE_NOTIFY_CHANGE_LAST_WRITE|FILE_NOTIFY_CHANGE_FILE_NAME
 

Start a watch.

Parameters:
watch The watch to start
changesMask The changes to monitor for (must be the same for all watches in a given directory at present)

void OW32::CFileWatcher::stopWatch CFileWatch watch  ) 
 

Stop a watch.

Parameters:
watch The watch to stop


The documentation for this class was generated from the following file:
Generated on Sun Jun 5 01:29:24 2005 for OW32 by  doxygen 1.3.9.1