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.
Differential Revision: https://reviews.llvm.org/D65708
llvm-svn: 367968
} else {
ExpectedInitial.erase(It);
}
- if (result())
+ if (result()) {
+ L.unlock();
ResultIsReady.notify_one();
+ }
}
void consumeNonInitial(DirectoryWatcher::Event E) {
} else {
ExpectedNonInitial.erase(It);
}
- if (result())
+ if (result()) {
+ L.unlock();
ResultIsReady.notify_one();
+ }
}
// This method is used by DirectoryWatcher.