forked from OSchip/llvm-project
[Orc][RPC] Unlock message send/receive locks on failure.
This fixes some destruction-of-locked-mutex errors in RawByteChannel. llvm-svn: 293375
This commit is contained in:
parent
587f1f57ad
commit
2f02116b27
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue