1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[Support/Parallel] Use lock_guard which has less overhead than unique_lock.

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
This commit is contained in:
Fangrui Song 2018-03-22 23:40:02 +00:00
parent 6aab60b5c7
commit b31d20d634

View File

@ -56,12 +56,12 @@ public:
~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();
}