[PATCH] D74371: [DirectoryWatcher] Fix misuse of FSEvents API and data race
Ben Langmuir via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 10 17:50:54 PST 2020
benlangmuir created this revision.
benlangmuir added reviewers: jkorous, akyrtzi.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
I observed two bugs in the DirectoryWatcher on macOS
1. We were calling FSEventStreamStop and FSEventStreamInvalidate before we called FSEventStreamStart and FSEventStreamSetDispatchQueue, if the DirectoryWatcher was destroyed before the initial async work was done. This violates the requirements of the FSEvents API.
2. Calls to Receiver could race between the initial work and the invalidation during destruction.
The second issue is easier to see when using TSan.
rdar://59215667
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74371
Files:
clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74371.243706.patch
Type: text/x-patch
Size: 4722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200211/b417a775/attachment.bin>
More information about the cfe-commits
mailing list