Child.childWatchSourceNew

Creates a new child_watch source.

The source will not initially be associated with any #GMainContext and must be added to one with g_source_attach() before it will be executed.

Note that child watch sources can only be used in conjunction with g_spawn... when the %G_SPAWN_DO_NOT_REAP_CHILD flag is used.

Note that on platforms where #GPid must be explicitly closed (see g_spawn_close_pid()) @pid must not be closed while the source is still active. Typically, you will want to call g_spawn_close_pid() in the callback function for the source.

Note further that using g_child_watch_source_new() is not compatible with calling waitpid with a nonpositive first argument in the application. Calling waitpid() for individual pids will still work fine.

Similarly, on POSIX platforms, the @pid passed to this function must be greater than 0 (i.e. this function must wait for a specific child, and cannot wait for one of many children by using a nonpositive argument).

struct Child
static
childWatchSourceNew
(
GPid pid
)

Parameters

pid GPid

process to watch. On POSIX the positive pid of a child process. On Windows a handle for a process (which doesn't have to be a child).

Return Value

Type: Source

the newly-created child watch source

Meta