Fix race condition in the state machine & channel.

This commit is contained in:
Alexey Rybalchenko 2016-11-15 13:08:38 +01:00
parent 94a4d599eb
commit 12f04c7237
4 changed files with 6 additions and 3 deletions

View File

@ -539,6 +539,7 @@ bool FairMQChannel::InitCommandInterface(FairMQTransportFactory* factory, int nu
void FairMQChannel::ResetChannel()
{
boost::unique_lock<boost::mutex> scoped_lock(fChannelMutex);
fIsValid = false;
// TODO: implement channel resetting
}

View File

@ -133,6 +133,7 @@ void FairMQStateMachine::WaitForEndOfState(int event)
{
fStateCondition.wait(lock);
}
fStateThread.join();
}
catch (boost::exception& e)
{

View File

@ -250,8 +250,8 @@ struct FairMQFSM_ : public msm::front::state_machine_def<FairMQFSM_>
template <class EVT, class FSM, class SourceState, class TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{
LOG(STATE) << "RUNNING state finished without an external event, going to IDLE";
LOG(STATE) << "RUNNING state finished without an external event";
LOG(STATE) << "Entering READY state";
fsm.fState = READY;
}
};
@ -380,7 +380,7 @@ struct FairMQFSM_ : public msm::front::state_machine_def<FairMQFSM_>
std::size_t pos = stateName.find("_FSME");
stateName.erase(pos);
if (stateName == "1RUNNING" || stateName == "6DEVICE_READY" || stateName == "0PAUSED")
if (stateName == "1RUNNING" || stateName == "6DEVICE_READY" || stateName == "0PAUSED" || stateName == "8RESETTING_TASK")
{
stateName = stateName.substr(1);
}

View File

@ -18,6 +18,7 @@
#include <condition_variable>
#include <mutex>
#include <chrono>
#include <set>
using namespace std;
using namespace dds::intercom_api;