[gtk+/gtk-2-24-quartz] quartz: fix a race condition when waking up the CGRunLoop
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24-quartz] quartz: fix a race condition when waking up the CGRunLoop
- Date: Wed, 23 Nov 2011 23:05:01 +0000 (UTC)
commit 2ed2fa8fbf8d049865250649366eaf24ca4a3890
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 11 23:49:21 2011 +0100
quartz: fix a race condition when waking up the CGRunLoop
Wake up the run loop unconditionally (don't check if it is waiting) because
it might go into waiting state right after we checked for it. Fixes GIMP
startup (which has a lot of GIOChannel I/O but zero NSEvents) from several
minutes to a few seconds.
gdk/quartz/gdkeventloop-quartz.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gdk/quartz/gdkeventloop-quartz.c b/gdk/quartz/gdkeventloop-quartz.c
index 0462f21..97a7e39 100644
--- a/gdk/quartz/gdkeventloop-quartz.c
+++ b/gdk/quartz/gdkeventloop-quartz.c
@@ -207,9 +207,12 @@ signal_main_thread (void)
*/
if (!run_loop_polling_async)
CFRunLoopSourceSignal (select_main_thread_source);
-
- if (CFRunLoopIsWaiting (main_thread_run_loop))
- CFRunLoopWakeUp (main_thread_run_loop);
+
+ /* Don't check for CFRunLoopIsWaiting() here because it causes a
+ * race condition (the loop could go into waiting state right after
+ * we checked).
+ */
+ CFRunLoopWakeUp (main_thread_run_loop);
}
static void *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]