summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dali/internal/system/common/async-task-manager-impl.cpp19
-rw-r--r--dali/internal/system/common/async-task-manager-impl.h1
2 files changed, 12 insertions, 8 deletions
diff --git a/dali/internal/system/common/async-task-manager-impl.cpp b/dali/internal/system/common/async-task-manager-impl.cpp
index 2f2a2bf8a..ab0c6465d 100644
--- a/dali/internal/system/common/async-task-manager-impl.cpp
+++ b/dali/internal/system/common/async-task-manager-impl.cpp
@@ -670,17 +670,20 @@ void AsyncTaskManager::AddTask(AsyncTaskPtr task)
}
}
- size_t count = mTasks.GetElementCount();
- size_t index = 0;
- while(index++ < count)
{
- auto processHelperIt = mTasks.GetNext();
- DALI_ASSERT_ALWAYS(processHelperIt != mTasks.End());
- if(processHelperIt->Request())
+ Mutex::ScopedLock lock(mTasksMutex);
+ size_t count = mTasks.GetElementCount();
+ size_t index = 0;
+ while(index++ < count)
{
- break;
+ auto processHelperIt = mTasks.GetNext();
+ DALI_ASSERT_ALWAYS(processHelperIt != mTasks.End());
+ if(processHelperIt->Request())
+ {
+ break;
+ }
+ // If all threads are busy, then it's ok just to push the task because they will try to get the next job.
}
- // If all threads are busy, then it's ok just to push the task because they will try to get the next job.
}
// Register Process (Since mTrigger execute too late timing if event thread running a lots of events.)
diff --git a/dali/internal/system/common/async-task-manager-impl.h b/dali/internal/system/common/async-task-manager-impl.h
index 7729ff5f0..4edf53830 100644
--- a/dali/internal/system/common/async-task-manager-impl.h
+++ b/dali/internal/system/common/async-task-manager-impl.h
@@ -270,6 +270,7 @@ private:
Dali::Mutex mWaitingTasksMutex; ///< Mutex for mWaitingTasks. We can lock mRunningTasksMutex and mCompletedTasksMutex under this scope.
Dali::Mutex mRunningTasksMutex; ///< Mutex for mRunningTasks. We can lock mCompletedTasksMutex under this scope.
Dali::Mutex mCompletedTasksMutex; ///< Mutex for mCompletedTasks. We cannot lock any mutex under this scope.
+ Dali::Mutex mTasksMutex; ///< Mutex for mTasks. We cannot lock any mutex under this scope.
std::unique_ptr<EventThreadCallback> mTrigger;