#include #include #define NEXIT 33 typedef struct Onex Onex; struct Onex{ void (*f)(void); int pid; }; static Lock onexlock; Onex onex[NEXIT]; atexit(void (*f)(void)) { int i; lock(&onexlock); for(i=0; i= 0; i--) if((f = onex[i].f) && pid == onex[i].pid) { onex[i].f = 0; (*f)(); } _exits(s); } #pragma profile on