gmain: simplify handling child watchers in dispatch_unix_signals_unlocked()

- if a child watch source has "using_pidfd", it is never linked in the
  unix_child_watches list. Drop that check.
- replace the deep nested if, with an early "continue" in the loop,
  if we detect there is nothing to do. It makes the code easier to
  read.
This commit is contained in:
Thomas Haller 2023-03-28 15:44:30 +02:00
parent 9315a211fa
commit a71b0c0461

View File

@ -5695,11 +5695,11 @@ dispatch_unix_signals_unlocked (void)
for (node = unix_child_watches; node; node = node->next)
{
GChildWatchSource *source = node->data;
if (!source->using_pidfd &&
!g_atomic_int_get (&source->child_exited))
{
pid_t pid;
if (g_atomic_int_get (&source->child_exited))
continue;
do
{
g_assert (source->pid > 0);
@ -5721,7 +5721,6 @@ dispatch_unix_signals_unlocked (void)
while (pid == -1 && errno == EINTR);
}
}
}
/* handle GUnixSignalWatchSource instances */
for (node = unix_signal_watches; node; node = node->next)