[llvm] r293375 - [Orc][RPC] Unlock message send/receive locks on failure.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 02:19:48 PST 2017


Author: lhames
Date: Sat Jan 28 04:19:47 2017
New Revision: 293375

URL: http://llvm.org/viewvc/llvm-project?rev=293375&view=rev
Log:
[Orc][RPC] Unlock message send/receive locks on failure.

This fixes some destruction-of-locked-mutex errors in RawByteChannel.


Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h?rev=293375&r1=293374&r2=293375&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h Sat Jan 28 04:19:47 2017
@@ -813,20 +813,20 @@ public:
     // Open the function call message.
     if (auto Err = C.startSendMessage(FnId, SeqNo)) {
       abandonPendingResponses();
-      return joinErrors(std::move(Err), C.endSendMessage());
+      return Err;
     }
 
     // Serialize the call arguments.
     if (auto Err = detail::HandlerTraits<typename Func::Type>::serializeArgs(
             C, Args...)) {
       abandonPendingResponses();
-      return joinErrors(std::move(Err), C.endSendMessage());
+      return Err;
     }
 
     // Close the function call messagee.
     if (auto Err = C.endSendMessage()) {
       abandonPendingResponses();
-      return std::move(Err);
+      return Err;
     }
 
     return Error::success();

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h?rev=293375&r1=293374&r2=293375&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h Sat Jan 28 04:19:47 2017
@@ -48,7 +48,11 @@ public:
   template <typename FunctionIdT, typename SequenceIdT>
   Error startSendMessage(const FunctionIdT &FnId, const SequenceIdT &SeqNo) {
     writeLock.lock();
-    return serializeSeq(*this, FnId, SeqNo);
+    if (auto Err = serializeSeq(*this, FnId, SeqNo)) {
+      writeLock.unlock();
+      return Err;
+    }
+    return Error::success();
   }
 
   /// Notify the channel that we're ending a message send.
@@ -63,7 +67,11 @@ public:
   template <typename FunctionIdT, typename SequenceNumberT>
   Error startReceiveMessage(FunctionIdT &FnId, SequenceNumberT &SeqNo) {
     readLock.lock();
-    return deserializeSeq(*this, FnId, SeqNo);
+    if (auto Err = deserializeSeq(*this, FnId, SeqNo)) {
+      readLock.unlock();
+      return Err;
+    }
+    return Error::success();
   }
 
   /// Notify the channel that we're ending a message receive.




More information about the llvm-commits mailing list