exit.c (1574) | exit.c (35125) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 38#include <stdlib.h> 39#include <unistd.h> 40#include "atexit.h" 41 42void (*__cleanup)(); 43 44/* | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 38#include <stdlib.h> 39#include <unistd.h> 40#include "atexit.h" 41 42void (*__cleanup)(); 43 44/* |
45 * This variable is zero until a process has created a thread. 46 * It is used to avoid calling locking functions in libc when they 47 * are not required. By default, libc is intended to be(come) 48 * thread-safe, but without a (significant) penalty to non-threaded 49 * processes. 50 */ 51int __isthreaded = 0; 52 53/* |
|
45 * Exit, flushing stdio buffers if necessary. 46 */ 47void 48exit(status) 49 int status; 50{ 51 register struct atexit *p; 52 register int n; 53 54 for (p = __atexit; p; p = p->next) 55 for (n = p->ind; --n >= 0;) 56 (*p->fns[n])(); 57 if (__cleanup) 58 (*__cleanup)(); 59 _exit(status); 60} | 54 * Exit, flushing stdio buffers if necessary. 55 */ 56void 57exit(status) 58 int status; 59{ 60 register struct atexit *p; 61 register int n; 62 63 for (p = __atexit; p; p = p->next) 64 for (n = p->ind; --n >= 0;) 65 (*p->fns[n])(); 66 if (__cleanup) 67 (*__cleanup)(); 68 _exit(status); 69} |