Rev | Line | |
---|
[9] | 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 |
|
---|
| 13 | static int callindex = 0;
|
---|
| 14 | static int (*proclist[MAXPROCS])();
|
---|
| 15 |
|
---|
| 16 | _cleanup()
|
---|
| 17 | {
|
---|
| 18 | while (--callindex >= 0)
|
---|
| 19 | (*proclist[callindex])();
|
---|
| 20 | callindex = 0;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | CallAtEnd(p)
|
---|
| 24 | int (*p)();
|
---|
| 25 | {
|
---|
| 26 | if (callindex >= MAXPROCS) {
|
---|
| 27 | return 0;
|
---|
| 28 | }
|
---|
| 29 | proclist[callindex++] = p;
|
---|
| 30 | return 1;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | halt()
|
---|
| 34 | {
|
---|
| 35 | _cleanup();
|
---|
| 36 | _exit(0);
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.