Children management

Children management — Children management in Anjuta

Stability Level

Unstable, unless otherwise indicated

Synopsis


#include <libanjuta/anjuta-children.h>


void                (*AnjutaChildTerminatedCallback)    (int exit_staus,
                                                         gpointer user_data);
void                anjuta_children_register            (pid_t pid,
                                                         AnjutaChildTerminatedCallback ch_terminated,
                                                         gpointer data);
void                anjuta_children_unregister          (pid_t pid);
void                anjuta_children_foreach             (GFunc cb,
                                                         gpointer data);
void                anjuta_children_recover             (void);
void                anjuta_children_finalize            (void);

Description

All child processes in anjuta are registred using API here. SIGCHLD should never be used directly. Use anjuta_children_register() or anjuta_children_unregister() to register or unregister a child process. Notifications are sent if callback function is given in anjuta_children_register(), which can be used in lieu of hooking SIGCHLD signal.

plugin developers should not bother about anjuta_children_init() and anjuta_children_finalize() functions. They are only for the shell implementor.

Details

AnjutaChildTerminatedCallback ()

void                (*AnjutaChildTerminatedCallback)    (int exit_staus,
                                                         gpointer user_data);

Callback function definition for child termination.

exit_staus : Exit status of the child.
user_data : User data

anjuta_children_register ()

void                anjuta_children_register            (pid_t pid,
                                                         AnjutaChildTerminatedCallback ch_terminated,
                                                         gpointer data);

Registers a child process with the manager. ch_terminated will be called when the child terminates. DO NOT use SIGCHLD directly, otherwise whole children management will fail.

pid : Process ID of the child (usually the value retured by fork or similar system calls.
ch_terminated : Callback function which will be called when this child exits. The callback should be defined as the type AnjutaChildTerminatedCallback.
data : User data.

anjuta_children_unregister ()

void                anjuta_children_unregister          (pid_t pid);

Unregisters the child process (It should have been registred before with #anjuta_children_register() call). No child terminated callback will be executed for this child.

pid : Process ID of the child.

anjuta_children_foreach ()

void                anjuta_children_foreach             (GFunc cb,
                                                         gpointer data);

Calls the given callback function with the data for each child registered, that have not yet been terminated.

cb : Callback function.
data : User data.

anjuta_children_recover ()

void                anjuta_children_recover             (void);

Recovers child management signaling.


anjuta_children_finalize ()

void                anjuta_children_finalize            (void);

Shuts down the children management. Usually not required to call, if you you are anyway exiting the program.