source: trunk/minix/lib/ack/libm2/halt.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 651 bytes
Line 
1/*
2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
4*/
5
6/*
7 Module: program termination routines
8 Author: Ceriel J.H. Jacobs
9 Version: $Header: /cvsup/minix/src/lib/ack/libm2/halt.c,v 1.1 2005/10/10 15:27:46 beng Exp $
10*/
11#define MAXPROCS 32
12
13static int callindex = 0;
14static int (*proclist[MAXPROCS])();
15
16_cleanup()
17{
18 while (--callindex >= 0)
19 (*proclist[callindex])();
20 callindex = 0;
21}
22
23CallAtEnd(p)
24 int (*p)();
25{
26 if (callindex >= MAXPROCS) {
27 return 0;
28 }
29 proclist[callindex++] = p;
30 return 1;
31}
32
33halt()
34{
35 _cleanup();
36 _exit(0);
37}
Note: See TracBrowser for help on using the repository browser.