Avoiding Deadlocks
As the Cached and Non-Cached Requests topic describes, it is common for the filesystem requests intercepted by a CBFilter/CBMonitor-based application to have been sent by the system's cache manager rather than by an actual process. Consequently, it is critical to keep the following restrictions in mind when implementing the application's event handlers:
- Event handlers must not perform any operations, explicitly or implicitly, against files opened in buffered mode. Any file accessed from an event handler must be opened using the Windows API's FILE_FLAG_NO_BUFFERING flag.
- Event handlers must not perform any asynchronous procedure calls (APCs).
- User interface operations must be strongly restricted.
- Plus, all CBFilter/CBMonitor-specific restrictions discussed in the Recursive Calls topic.
Events handlers which violate any of the restrictions described above will cause a system-wide deadlock.