[Reproducers] Fix data race found by tsan

This fixes a data race uncovered by tsan during destruction of the
GDBRemoteReplay server. The solution is to lock the thread state mutex
when receiving packets.

llvm-svn: 356168
This commit is contained in:
Jonas Devlieghere 2019-03-14 17:19:34 +00:00
parent 702411fc29
commit fa3f6401da
1 changed files with 2 additions and 0 deletions

View File

@ -55,6 +55,8 @@ GDBRemoteCommunicationReplayServer::~GDBRemoteCommunicationReplayServer() {
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
Timeout<std::micro> timeout, Status &error, bool &interrupt, bool &quit) {
std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
StringExtractorGDBRemote packet;
PacketResult packet_result = WaitForPacketNoLock(packet, timeout, false);