ChildWatchSource


Description:

public ChildWatchSource (Pid pid)

Creates a new child_watch source.

The source will not initially be associated with any MainContext and must be added to one with 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 Pid must be explicitly closed (see close_pid) pid must not be closed while the source is still active. Typically, you will want to call close_pid in the callback function for the source.

Note further that using ChildWatchSource 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).

Parameters:

pid

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 ).

Returns:

the newly-created child watch source