[llvm] r367781 - [ORC] Remove a layer of indirection when locking the mutex. NFCI.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 04:08:32 PDT 2019


Author: d0k
Date: Sun Aug  4 04:08:32 2019
New Revision: 367781

URL: http://llvm.org/viewvc/llvm-project?rev=367781&view=rev
Log:
[ORC] Remove a layer of indirection when locking the mutex. NFCI.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h?rev=367781&r1=367780&r2=367781&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h Sun Aug  4 04:08:32 2019
@@ -38,17 +38,12 @@ private:
 public:
   // RAII based lock for ThreadSafeContext.
   class LLVM_NODISCARD Lock {
-  private:
-    using UnderlyingLock = std::lock_guard<std::recursive_mutex>;
-
   public:
-    Lock(std::shared_ptr<State> S)
-        : S(std::move(S)),
-          L(llvm::make_unique<UnderlyingLock>(this->S->Mutex)) {}
+    Lock(std::shared_ptr<State> S) : S(std::move(S)), L(this->S->Mutex) {}
 
   private:
     std::shared_ptr<State> S;
-    std::unique_ptr<UnderlyingLock> L;
+    std::unique_lock<std::recursive_mutex> L;
   };
 
   /// Construct a null context.




More information about the llvm-commits mailing list