(Image Atlas) Fix helgrind simultaneous access issue 46/52646/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 25 Nov 2015 09:46:10 +0000 (09:46 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 25 Nov 2015 09:46:39 +0000 (09:46 +0000)
Change-Id: I948c61ab962bd1469cafae82c7ee5c8709c722f0

dali-toolkit/internal/image-atlas/image-load-thread.cpp

index d106690..c7da85b 100644 (file)
@@ -87,14 +87,14 @@ CompleteQueue::~CompleteQueue()
 
 LoadingTask* CompleteQueue::NextTask()
 {
 
 LoadingTask* CompleteQueue::NextTask()
 {
-  while( mTasks.Empty() )
+  // Lock while popping task out from the queue
+  Mutex::ScopedLock lock( mMutex );
+
+  if( mTasks.Empty() )
   {
     return NULL;
   }
 
   {
     return NULL;
   }
 
-  // Lock while popping task out from the queue
-  Mutex::ScopedLock lock( mMutex );
-
   Vector< LoadingTask* >::Iterator next = mTasks.Begin();
   LoadingTask* nextTask = *next;
   mTasks.Erase( next );
   Vector< LoadingTask* >::Iterator next = mTasks.Begin();
   LoadingTask* nextTask = *next;
   mTasks.Erase( next );