source: trunk/src/emx/src/lib/misc/on_exit.c@ 1905

Last change on this file since 1905 was 1905, checked in by bird, 21 years ago

Rewrote atexit() fixing recursive exit() calling. Added on_exit().

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1/* $Id: on_exit.c 1905 2005-04-24 12:11:40Z bird $ */
2/** @file
3 *
4 * LIBC on_exit().
5 *
6 * Copyright (c) 2005 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This file is part of InnoTek LIBC.
10 *
11 * InnoTek LIBC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * InnoTek LIBC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with InnoTek LIBC; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include "libc-alias.h"
32#include <stdlib.h>
33#include <InnoTekLIBC/atexit.h>
34
35
36int _STD(on_exit)(void (*pfnCallback)(int iExit, void *pvUser), void *pvUser)
37{
38 __LIBC_PATEXIT pCur = __libc_atexit_new();
39 if (pCur)
40 {
41 pCur->u.OnExit.pfnCallback = pfnCallback;
42 pCur->u.OnExit.pvUser = pvUser;
43 pCur->enmType = __LIBC_ATEXITTYPE_ONEXIT;
44 return 0;
45 }
46 return -1;
47}
48
Note: See TracBrowser for help on using the repository browser.