Let we make to do not execute same tasks at multiple threads
at the same timing.
It will make sure that we can control AsyncTask::Process API works
more thread-safety.
Change-Id: I5986c4a683a61ba03b2737d201fc5e7d602fc9de
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
taskAvaliable = (mAvaliableLowPriorityTaskCounts > 0u); // priority is low, but we can use it.
}
+ // Check whether we try to running same task at multiple threads.
+ if(taskAvaliable)
+ {
+ Mutex::ScopedLock lock(mRunningTasksMutex); // We can lock this mutex under mWaitingTasksMutex.
+ auto mapIter = mCacheImpl->mRunningTasksCache.find((*iter).Get());
+ if(mapIter != mCacheImpl->mRunningTasksCache.end())
+ {
+ if(!mapIter->second.empty())
+ {
+ // Some other thread running this tasks now. Ignore it.
+ DALI_LOG_INFO(gAsyncTasksManagerLogFilter, Debug::Verbose, "Some other thread running this task [%p]\n", (*iter).Get());
+ taskAvaliable = false;
+ }
+ }
+ }
+
if(taskAvaliable)
{
nextTask = *iter;