gmain: do not wakeup the wakeup registration

Do not wakeup immediately for our own context wakeup poll registration.

g_main_context_add_poll_unlocked() will call g_wakeup_signal() to wake
up the loop waiting in poll(). Doing so during context creation will
create an extra wakeup for the first poll().

Skip the wakeup call if it is the wake_up_rec registration. No other
sources/caller should ever reach that condition.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-07-07 15:50:10 +04:00
parent a43723ef17
commit 17ac6642c7

View File

@ -4653,6 +4653,7 @@ g_main_context_add_poll_unlocked (GMainContext *context,
context->poll_changed = TRUE; context->poll_changed = TRUE;
/* Now wake up the main loop if it is waiting in the poll() */ /* Now wake up the main loop if it is waiting in the poll() */
if (fd != &context->wake_up_rec)
g_wakeup_signal (context->wakeup); g_wakeup_signal (context->wakeup);
} }