gmain: Document constraints on waitpid
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Oct 2012 14:19:20 +0000 (10:19 -0400)
committerColin Walters <walters@verbum.org>
Mon, 29 Oct 2012 14:19:20 +0000 (10:19 -0400)
commit00f4c12bf97432a50e49749895d2c8174e204907
tree808c3dffb4bc9056698fdd01cec19b58bce0c13f
parentcff536c99ed22f83a09a1030c720f1555240390b
gmain: Document constraints on waitpid

Applications that use glib should not invoke waitpid with a first
argument that is nonpositive, because when such a waitpid is run in
one thread and glib waits for a subprocess in another, there is a race
condition, and the former waitpid can reap a process that was intended
for the latter.  Mention this in the documentation for
g_child_watch_source_new, and in the diagnostic generated by
g_spawn_sync when its waitpid fails with errno equal to ECHILD.

Signed-off-by: Colin Walters <walters@verbum.org>
http://bugzilla.gnome.org/show_bug.cgi?id=687075
glib/gmain.c
glib/gspawn.c