GSK Reference Manual | ||||
---|---|---|---|---|
int (*GskForkFunc) (gpointer data); gint gsk_fork (GskForkFunc action, gpointer data, GError **error); void gsk_fork_add_cleanup_fd (int fd); void gsk_fork_remove_cleanup_fd (int fd); void gsk_fork_child_cleanup (void);
This provides a way to register file descriptors that should be closed by the background thread. It also contains a gsk-like wrapper to fork.. that is, a callback oriented fork interface.
int (*GskForkFunc) (gpointer data);
Function to call from the background process.
data : |
data passed through gsk_fork() .
|
Returns : | the exit status of this process. |
gint gsk_fork (GskForkFunc action, gpointer data, GError **error);
Fork a new thread, cleaning up loose file-descriptors, then running the background function, and exiting with the return value of the background function.
action : |
function to call from the background process. |
data : |
user-data to pass to action .
|
error : |
optional place to errors to be put. |
Returns : | the process-id of the background thread, or -1 on error. |
void gsk_fork_add_cleanup_fd (int fd);
Add a file-descriptor to the list that should be closed
when fork()
is run.
A file-descriptor must only be added once.
fd : |
a file descriptor that should be closed from a background thread. |
void gsk_fork_remove_cleanup_fd (int fd);
Remove a file-descriptor from the list that should be closed
when fork()
is run.
fd : |
remove a file descriptor that was previously registered
to be closed on fork with gsk_fork_add_cleanup_fd() .
|