Fix CID 169525 Data race condition

This commit is contained in:
Dennis Klein 2017-05-17 18:44:51 +02:00
parent c78541432f
commit ec786dce03
3 changed files with 16 additions and 1 deletions

View File

@ -410,6 +410,20 @@ void FairMQChannel::UpdateRateLogging(const int rateLogging)
} }
} }
auto FairMQChannel::SetModified(const bool modified) -> void
{
try
{
unique_lock<mutex> lock(fChannelMutex);
fModified = modified;
}
catch (exception& e)
{
LOG(ERROR) << "Exception caught in FairMQChannel::SetModified: " << e.what();
exit(EXIT_FAILURE);
}
}
bool FairMQChannel::IsValid() const bool FairMQChannel::IsValid() const
{ {
try try

View File

@ -270,6 +270,7 @@ class FairMQChannel
static std::atomic<bool> fInterrupted; static std::atomic<bool> fInterrupted;
bool fMultipart; bool fMultipart;
bool fModified; bool fModified;
auto SetModified(const bool modified) -> void;
bool fReset; bool fReset;
}; };

View File

@ -129,7 +129,7 @@ void FairMQDevice::AttachChannels(list<FairMQChannel*>& chans)
if (AttachChannel(**itr)) if (AttachChannel(**itr))
{ {
(*itr)->InitCommandInterface(); (*itr)->InitCommandInterface();
(*itr)->fModified = false; (*itr)->SetModified(false);
chans.erase(itr++); chans.erase(itr++);
} }
else else