mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-20 17:22:11 +01:00
gmain: Partial revert of recent wakeup changes to gmain.c
This reverts the following commits (but keeps the other recent changes to gmain.c): • e4ee3079c Do not wake up main loop if change is from same thread • 208702404 main: Create a helper function for "owner wakeup" optimization • 0c0469b56 gmain: Signal wakeups if context has never been acquired as well • 9ba95e25b gmain: only signal GWakeup right before or during a blocking poll Some combination of them is causing problems with LibreOffice and/or WebKit, and the safest thing to do at the moment is revert them all until we work out what’s going on. The previous revert (4976e8109) was not sufficient (it fixed WebKit, but re-broken LibreOffice). By reverting, we gain some spurious wakeups, but avoid dropping necessary wakeups, which is presumably what’s causing problems in the other modules. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=761102
This commit is contained in:
parent
56b2983b77
commit
94b38beff1
33
glib/gmain.c
33
glib/gmain.c
@ -1118,29 +1118,6 @@ source_remove_from_context (GSource *source,
|
||||
}
|
||||
}
|
||||
|
||||
/* See https://bugzilla.gnome.org/show_bug.cgi?id=761102 for
|
||||
* the introduction of this.
|
||||
*
|
||||
* The main optimization is to avoid waking up the main
|
||||
* context if a change is made by the current owner.
|
||||
*/
|
||||
static void
|
||||
conditional_wakeup (GMainContext *context)
|
||||
{
|
||||
/* We want to signal wakeups in two cases:
|
||||
* 1 When the context is owned by another thread
|
||||
* 2 When the context owner is NULL (two subcases)
|
||||
* 2a Possible if the context has never been acquired
|
||||
* 2b Or if the context has no current owner
|
||||
*
|
||||
* At least case 2a) is necessary to ensure backwards compatibility with
|
||||
* qemu's use of GMainContext.
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14
|
||||
*/
|
||||
if (context->owner != G_THREAD_SELF)
|
||||
g_wakeup_signal (context->wakeup);
|
||||
}
|
||||
|
||||
static guint
|
||||
g_source_attach_unlocked (GSource *source,
|
||||
GMainContext *context,
|
||||
@ -1187,8 +1164,8 @@ g_source_attach_unlocked (GSource *source,
|
||||
/* If another thread has acquired the context, wake it up since it
|
||||
* might be in poll() right now.
|
||||
*/
|
||||
if (do_wakeup)
|
||||
conditional_wakeup (context);
|
||||
if (do_wakeup && context->owner && context->owner != G_THREAD_SELF)
|
||||
g_wakeup_signal (context->wakeup);
|
||||
|
||||
return source->source_id;
|
||||
}
|
||||
@ -1878,7 +1855,7 @@ g_source_set_ready_time (GSource *source,
|
||||
{
|
||||
/* Quite likely that we need to change the timeout on the poll */
|
||||
if (!SOURCE_BLOCKED (source))
|
||||
conditional_wakeup (context);
|
||||
g_wakeup_signal (context->wakeup);
|
||||
UNLOCK_CONTEXT (context);
|
||||
}
|
||||
}
|
||||
@ -4318,7 +4295,7 @@ g_main_context_add_poll_unlocked (GMainContext *context,
|
||||
context->poll_changed = TRUE;
|
||||
|
||||
/* Now wake up the main loop if it is waiting in the poll() */
|
||||
conditional_wakeup (context);
|
||||
g_wakeup_signal (context->wakeup);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4378,7 +4355,7 @@ g_main_context_remove_poll_unlocked (GMainContext *context,
|
||||
context->poll_changed = TRUE;
|
||||
|
||||
/* Now wake up the main loop if it is waiting in the poll() */
|
||||
conditional_wakeup (context);
|
||||
g_wakeup_signal (context->wakeup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user