Summary: unique_lock has the overhead of tracking ownership status and the owner.
Reviewers: grimar, zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44698
llvm-svn: 328271
~Latch() { sync(); }
void inc() {
- std::unique_lock<std::mutex> lock(Mutex);
+ std::lock_guard<std::mutex> lock(Mutex);
++Count;
}
void dec() {
- std::unique_lock<std::mutex> lock(Mutex);
+ std::lock_guard<std::mutex> lock(Mutex);
if (--Count == 0)
Cond.notify_all();
}