plotfi created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. plotfi added reviewers: compnerd, jkorous. Herald added a subscriber: dexonsmith.
This should not affect actual behavior, but should pessimize the threading less by avoiding the situation where: - mutex is still locked - T1 notifies on condition variable - T2 wakes to check mutex - T2 sees mutex is still locked - T2 waits - T1 unlocks mutex - T2 tries again, acquires mutex. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D65708 Files: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp Index: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp =================================================================== --- clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -132,8 +132,10 @@ } else { ExpectedInitial.erase(It); } - if (result()) + if (result()) { + L.unlock(); ResultIsReady.notify_one(); + } } void consumeNonInitial(DirectoryWatcher::Event E) { @@ -151,8 +153,10 @@ } else { ExpectedNonInitial.erase(It); } - if (result()) + if (result()) { + L.unlock(); ResultIsReady.notify_one(); + } } // This method is used by DirectoryWatcher.
Index: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp =================================================================== --- clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -132,8 +132,10 @@ } else { ExpectedInitial.erase(It); } - if (result()) + if (result()) { + L.unlock(); ResultIsReady.notify_one(); + } } void consumeNonInitial(DirectoryWatcher::Event E) { @@ -151,8 +153,10 @@ } else { ExpectedNonInitial.erase(It); } - if (result()) + if (result()) { + L.unlock(); ResultIsReady.notify_one(); + } } // This method is used by DirectoryWatcher.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits