5 #include "libc_private.h"
10 struct quick_exit_fn *next;
14 static struct quick_exit_fn *quick_exit_fns;
15 static spinlock_t quick_exit_spinlock;
20 * Register a function to be called at quick_exit.
23 at_quick_exit(void (*func)(void))
25 struct quick_exit_fn *fn;
27 fn = malloc(sizeof(struct quick_exit_fn));
34 _SPINLOCK(&quick_exit_spinlock);
36 fn->next = quick_exit_fns;
40 _SPINUNLOCK(&quick_exit_spinlock);
48 * Abandon a process. Execute all quick_exit handlers.
51 quick_exit(int status)
53 struct quick_exit_fn *fn;
56 _SPINLOCK(&quick_exit_spinlock);
57 for (fn = quick_exit_fns; fn != NULL; fn = fn->next) {
61 _SPINUNLOCK(&quick_exit_spinlock);