Merge waitpid() from g_spawn_sync into gmain()
authorColin Walters <walters@verbum.org>
Mon, 29 Oct 2012 19:44:16 +0000 (15:44 -0400)
committerColin Walters <walters@verbum.org>
Fri, 2 Nov 2012 13:19:13 +0000 (09:19 -0400)
commitce0022933c255313e010b27f977f4ae02aad1e7e
tree3b310578ea38fc26e2b263138d38ef95ae56db76
parent0bdf7fecaf1ffc7263d2bc48a87c99f4705138fc
Merge waitpid() from g_spawn_sync into gmain()

This is preparatory work for a future commit which will add a
"catchall" waitpid API.  If we don't synchronize here with the worker
thread, race conditions are possible.

This also ensures we have an error message if someone adds a child
watch for a nonexistent pid, etc.  Previously, we'd simply keep
calling waitpid() getting ECHILD, and ignoring it until the source was
removed. Now, we g_warning() and fire the source.

Thirdly, this ensures that the waitpid() call in gmain handles EINTR,
like the g_spawn_sync() one did.

https://bugzilla.gnome.org/show_bug.cgi?id=687061
glib/gmain.c
glib/gspawn.c