[all-commits] [llvm/llvm-project] 76f1ba: Revert "Revert "DirectoryWatcher: add an implement...

Saleem Abdulrasool via All-commits all-commits at lists.llvm.org
Sat Jun 12 09:41:40 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 76f1baa7875acd88bdd4b431eed6e2d2decfc0fe
      https://github.com/llvm/llvm-project/commit/76f1baa7875acd88bdd4b431eed6e2d2decfc0fe
  Author: Saleem Abdulrasool <compnerd at compnerd.org>
  Date:   2021-06-12 (Sat, 12 Jun 2021)

  Changed paths:
    M clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp
    M clang/unittests/DirectoryWatcher/CMakeLists.txt

  Log Message:
  -----------
  Revert "Revert "DirectoryWatcher: add an implementation for Windows""

This reverts commit 0ec1cf13f2a4e31aa2c5ccc665c5fbdcd3a94577.

Restore the implementation with some minor tweaks:
- Use std::unique_ptr for the path instead of std::vector
  * Stylistic improvement as the buffer is already heap allocated, this
    just makes it clearer.
- Correct the notification buffer allocation size
  * Memory usage fix: we were allocating 4x the computed size
- Correct the passing of the buffer size to RDC
  * Memory usage fix: we were reporting 1/4th of the size
- Convert the operation event to auto-reset
  * Bug Fix: we never reset the event
- Remove `FILE_NOTIFY_CHANGE_LAST_ACCESS` from RDC events
  * Memory usage fix: we never needed this notification
- Fold events for the notification action
  * Stylistic improvement to be clear how the events map
- Update comment
  * Stylistic improvement to be clear what the RAII controls
- Fix the race condition that was uncovered previously
  * We would return from the construction before the watcher thread
    began execution.  The test would then proceed to begin execution,
    and we would miss the initial notifications.  We now ensure that the
    watcher thread is initialized before we return.  This ensures that
    we do not miss the initial notifications.

Running the test on a SSD was able to uncover the access pattern.  This
now seems to pass reliably where it was previously flaky locally.




More information about the All-commits mailing list