add_full
Description:
public uint add_full (int priority, Pid pid, owned ChildWatchFunc function)
Sets a function to be called when the child indicated by pid exits, at the priority priority.
If you obtain pid from [func@GLib.spawn_async] or [func@GLib.spawn_async_with_pipes] you will need to pass [
flags@GLib.SpawnFlags.DO_NOT_REAP_CHILD] as a flag to the spawn function for the child watching to work.
In many programs, you will want to call [func@GLib.spawn_check_wait_status] in the callback to determine whether or not the child exited successfully.
Also, note that on platforms where [type@GLib.Pid] must be explicitly closed (see [func@GLib.spawn_close_pid]) pid must not be
closed while the source is still active. Typically, you should invoke [func@GLib.spawn_close_pid] in the callback function for the source.
GLib supports only a single callback per process ID. On POSIX platforms, the same restrictions mentioned for [func@GLib.child_watch_source_new] apply to this function.
This internally creates a main loop source using [func@GLib.child_watch_source_new] and attaches it to the main loop context using [ method@GLib.Source.attach]. You can do these steps manually if you need greater control.
Parameters:
| priority |
the priority of the idle source; typically this will be in the range between [const@GLib.PRIORITY_DEFAULT_IDLE] and [ const@GLib.PRIORITY_HIGH_IDLE] |
| pid |
process to watch — on POSIX systems, this is the positive PID of a child process; on Windows it is a handle for a process (which doesn’t have to be a child) |
| function |
function to call |
| data |
data to pass to |
| notify |
function to call when the idle is removed |
Returns:
|
the ID (greater than 0) of the event source |