Cleanup callback facilities

Name

ggRegisterCleanup, ggUnregisterCleanup, ggCleanupForceExit : Cleanup callback facilities

Synopsis

#include <ggi/gg.h>

typedef void (ggcleanup_func)(void *);

int ggRegisterCleanup(ggcleanup_func *func, void *arg);

int ggUnregisterCleanup(ggcleanup_func *func, void *arg);

void ggCleanupForceExit(void);

Description

ggRegisterCleanup registers a callback to be executed on exit. The function will be called with its argument.

ggUnregisterCleanup cancels a callback installed with ggRegisterCleanup.

Once ggCleanupForceExit is called, _exit(2) will be explicitly called after all cleanup callbacks.

Return value

ggRegisterCleanup and ggUnregisterCleanup return 0 on success, a negative error code otherwise.