Skip to content
Commit 9ba95e25 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Colin Walters
Browse files

gmain: only signal GWakeup right before or during a blocking poll

Since commit e4ee3079 ("Do not wake up main loop if change is from same
thread", bug 761102), GMainContext uses context->owner to decide if the
event loop is being run in the current thread.  However, what really
matters is the phase in the prepare/query/poll/check/dispatch sequence.
Wakeups are only needed between the end of prepare and the end of poll,
and then only if prepare found that no sources were ready.

There is no need to take threads into account, because prepare, check
and all callers of conditional_wakeup all look at the new need_wakeup
flag inside LOCK_CONTEXT/UNLOCK_CONTEXT.

With this change, g_main_context_is_owner and g_main_context_wait are
the only functions for which acquire/release matters, just like before
commit e4ee3079

.

Signed-off-by: default avatarPaolo Bonzini <bonzini@gnu.org>
parent 0c0469b5
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment