From c3ff262e498a67296a80608082ed8c921cb15f58 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 30 Jul 2012 13:13:30 +0200 Subject: [PATCH] Changed: #1440 Avoid possible race condition on exit --HG-- branch : build_pipeline_v3 --- .../pipeline/service/module_pipeline_master.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index 178b363fd..39fcced05 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -298,17 +298,23 @@ public: void handleUpdateTasks() { + IRunnable *currentRunnable; + { + NLMISC::CSynchronized>::CAccessor updateTasks(&m_UpdateTasks); + if (updateTasks.value().size() == 0) + return; + currentRunnable = updateTasks.value().front(); + } for (; ; ) { - IRunnable *currentRunnable; + currentRunnable->run(); { NLMISC::CSynchronized>::CAccessor updateTasks(&m_UpdateTasks); + updateTasks.value().pop_front(); if (updateTasks.value().size() == 0) break; currentRunnable = updateTasks.value().front(); - updateTasks.value().pop_front(); } - currentRunnable->run(); } }