[vlc-devel] [PATCH 3/9] VLCKit: Moved sleep() call to after some work has been processed
Florent Pillet
fpillet at gmail.com
Fri Jul 11 01:35:05 CEST 2014
---
Sources/VLCEventManager.m | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Sources/VLCEventManager.m b/Sources/VLCEventManager.m
index 6e61894..9cb6521 100644
--- a/Sources/VLCEventManager.m
+++ b/Sources/VLCEventManager.m
@@ -153,14 +153,11 @@ 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 */
- while (_messageQueue.count <= 0)
+ pthread_mutex_lock([self queueLock]);
+ while (_messageQueue.count <= 0)
pthread_cond_wait([self signalData], [self queueLock]);
/* Get the first object off the queue. */
@@ -226,6 +223,9 @@ static void * EventDispatcherMainLoop(void * user_data)
withObject:message
waitUntilDone: YES];
}
+
+ /* Sleep a bit not to flood the interface */
+ usleep(300);
}
}
--
1.8.5.2 (Apple Git-48)
More information about the vlc-devel
mailing list