diff options
| author | Fangrui Song <maskray@google.com> | 2018-03-22 23:40:02 +0000 | 
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2018-03-22 23:40:02 +0000 | 
| commit | 41e8e529161e9bb0f2f10c6e7f2b4b827983bc6b (patch) | |
| tree | 3b9c91968cb32567dc0890041b392b6a0f5b8ce4 /llvm | |
| parent | e975a473b7528d478553382ebdab2768f2cdce1f (diff) | |
| download | bcm5719-llvm-41e8e529161e9bb0f2f10c6e7f2b4b827983bc6b.tar.gz bcm5719-llvm-41e8e529161e9bb0f2f10c6e7f2b4b827983bc6b.zip  | |
[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
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Support/Parallel.h | 4 | 
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/Parallel.h b/llvm/include/llvm/Support/Parallel.h index 6bc0a6bbaf2..01b2bcdb812 100644 --- a/llvm/include/llvm/Support/Parallel.h +++ b/llvm/include/llvm/Support/Parallel.h @@ -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();    }  | 

