Run InitTask in the worker thread (same as all other state handlers).

This commit is contained in:
Alexey Rybalchenko
2017-09-06 12:54:00 +02:00
committed by Mohammad Al-Turany
parent bfb9feab03
commit 6349438829
3 changed files with 12 additions and 9 deletions

View File

@@ -176,8 +176,14 @@ struct FairMQFSM_ : public msmf::state_machine_def<FairMQFSM_>
LOG(STATE) << "Entering INITIALIZING TASK state";
fsm.fState = INITIALIZING_TASK;
fsm.InitTaskWrapper();
// fsm.fInitializingTaskThread = std::thread(&FairMQFSM_::InitTaskWrapper, &fsm);
std::unique_lock<std::mutex> lock(fsm.fWorkMutex);
while (fsm.fWorkActive)
{
fsm.fWorkDoneCondition.wait(lock);
}
fsm.fWorkAvailable = true;
fsm.fWork = std::bind(&FairMQFSM_::InitTaskWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one();
}
};