Changed: #1440 Avoid possible race condition on exit

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent d9272d06d9
commit c3ff262e49

@ -298,17 +298,23 @@ public:
void handleUpdateTasks() void handleUpdateTasks()
{ {
IRunnable *currentRunnable;
{
NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks);
if (updateTasks.value().size() == 0)
return;
currentRunnable = updateTasks.value().front();
}
for (; ; ) for (; ; )
{ {
IRunnable *currentRunnable; currentRunnable->run();
{ {
NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks); NLMISC::CSynchronized<std::deque<IRunnable *>>::CAccessor updateTasks(&m_UpdateTasks);
updateTasks.value().pop_front();
if (updateTasks.value().size() == 0) if (updateTasks.value().size() == 0)
break; break;
currentRunnable = updateTasks.value().front(); currentRunnable = updateTasks.value().front();
updateTasks.value().pop_front();
} }
currentRunnable->run();
} }
} }

Loading…
Cancel
Save