1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[Orc][RPC] Fix an obvious locking-order bug in RawByteChannel::startSendMessage.

The lock needs to be acquired before the data is sent, not afterwards. This
think-o slipped in during the refactor in r286620, but went unnoticed as the
resulting bug only manifests in multi-threaded clients (of which there are none
in-tree).

No unit test as the bug depends on thread scheduling.

llvm-svn: 291216
This commit is contained in:
Lang Hames 2017-01-06 06:22:31 +00:00
parent 524564be1e
commit 6a7892269d

View File

@ -47,9 +47,9 @@ public:
/// Locks the channel for writing.
template <typename FunctionIdT, typename SequenceIdT>
Error startSendMessage(const FunctionIdT &FnId, const SequenceIdT &SeqNo) {
writeLock.lock();
if (auto Err = serializeSeq(*this, FnId, SeqNo))
return Err;
writeLock.lock();
return Error::success();
}