00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #define MAXPROCS 32
00012
00013 static int callindex = 0;
00014 static int (*proclist[MAXPROCS])();
00015
00016 _cleanup()
00017 {
00018 while (--callindex >= 0)
00019 (*proclist[callindex])();
00020 callindex = 0;
00021 }
00022
00023 CallAtEnd(p)
00024 int (*p)();
00025 {
00026 if (callindex >= MAXPROCS) {
00027 return 0;
00028 }
00029 proclist[callindex++] = p;
00030 return 1;
00031 }
00032
00033 halt()
00034 {
00035 _cleanup();
00036 _exit(0);
00037 }