[PATCH] D44698: [Support/Parallel] Use lock_guard which has less overhead than unique_lock.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 22 16:42:54 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328271: [Support/Parallel] Use lock_guard which has less overhead than unique_lock. (authored by MaskRay, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D44698
Files:
llvm/trunk/include/llvm/Support/Parallel.h
Index: llvm/trunk/include/llvm/Support/Parallel.h
===================================================================
--- llvm/trunk/include/llvm/Support/Parallel.h
+++ llvm/trunk/include/llvm/Support/Parallel.h
@@ -56,12 +56,12 @@
~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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44698.139532.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180322/aa41f857/attachment.bin>
More information about the llvm-commits
mailing list