[PATCH] D88666: DirectoryWatcher: add an implementation for Windows

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 10:04:03 PDT 2020


compnerd added inline comments.


================
Comment at: clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp:95
+      CreateEvent(NULL, /*bManualReset=*/TRUE, /*bInitialState=*/FALSE, NULL);
+  assert(ovlIO.hEvent);
+
----------------
plotfi wrote:
> Can this be an assert with some message or some explanation of the hEvent return value? What happens if hEvent is non-zero on Release builds? 
I debated this myself which is why I added the `assert`.  Honestly, if this fails, there is very little that can be done.  This is creating an anonymous (unnamed) event.  The failure here would be caused by out-of-memory conditions (you're dead anyways) or system is completely out of resources (you're dead anyways).  I don't know of any recovery in that situation.  I really would prefer to avoid the two-phase construction which is going to be required if we want to handle that error scenario.  The event only makes sense after we have the directory handle, so I suppose that we could setup the event prior to the construction of the watcher itself, but that is just as much two-phase construction as adding an `initialize` method.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88666/new/

https://reviews.llvm.org/D88666



More information about the cfe-commits mailing list