소스 검색

VLCKit: Moved sleep() call to after some work has been processed

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Florent Pillet 11 년 전
부모
커밋
89b18fd9c7
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      Sources/VLCEventManager.m

+ 4 - 4
Sources/VLCEventManager.m

@@ -153,13 +153,10 @@ static void * EventDispatcherMainLoop(void * user_data)
         @autoreleasepool {
             message_t * message, * message_newer = NULL;
 
-            /* Sleep a bit not to flood the interface */
-            usleep(300);
-
             /* Wait for some data */
 
-            pthread_mutex_lock([self queueLock]);
             /* Wait until we have something on the queue */
+            pthread_mutex_lock([self queueLock]);
             while (_messageQueue.count <= 0)
                 pthread_cond_wait([self signalData], [self queueLock]);
 
@@ -226,6 +223,9 @@ static void * EventDispatcherMainLoop(void * user_data)
                                        withObject:message
                                     waitUntilDone: YES];
         }
+
+        /* Sleep a bit not to flood the interface */
+        usleep(300);
     }
 }