ReactOS  0.4.13-dev-544-gede3fdd
atonexit.c File Reference
#include <oscalls.h>
#include <internal.h>
#include <stdlib.h>
#include <crtdefs.h>
#include <limits.h>
Include dependency graph for atonexit.c:

Go to the source code of this file.

Macros

#define _DLL
 
#define _EXIT_LOCK1   8
 

Functions

void __cdecl _lock (int _File)
 
void __cdecl _unlock (int _File)
 
_CRTIMP _onexit_t __cdecl __dllonexit (_onexit_t, _PVFV **, _PVFV **)
 
 _onexit_t (__cdecl *__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func)
 
_onexit_t __cdecl mingw_onexit (_onexit_t func)
 
int __cdecl atexit (_PVFV func)
 

Variables

_PVFV__onexitbegin
 
_PVFV__onexitend
 

Macro Definition Documentation

◆ _DLL

#define _DLL

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 9 of file atonexit.c.

◆ _EXIT_LOCK1

#define _EXIT_LOCK1   8

Definition at line 19 of file atonexit.c.

Function Documentation

◆ __dllonexit()

_CRTIMP _onexit_t __cdecl __dllonexit ( _onexit_t  ,
_PVFV **  ,
_PVFV **   
)

Referenced by mingw_onexit().

◆ _lock()

void __cdecl _lock ( int  _File)

Definition at line 97 of file lock.c.

98 {
99  TRACE( "(%d)\n", locknum );
100 
101  /* If the lock doesn't exist yet, create it */
102  if( lock_table[ locknum ].bInit == FALSE )
103  {
104  /* Lock while we're changing the lock table */
105  _lock( _LOCKTAB_LOCK );
106 
107  /* Check again if we've got a bit of a race on lock creation */
108  if( lock_table[ locknum ].bInit == FALSE )
109  {
110  TRACE( ": creating lock #%d\n", locknum );
111  msvcrt_initialize_mlock( locknum );
112  }
113 
114  /* Unlock ourselves */
116  }
117 
118  EnterCriticalSection( &(lock_table[ locknum ].crit) );
119 }
void _unlock(int locknum)
Definition: lock.c:126
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static LOCKTABLEENTRY lock_table[_TOTAL_LOCKS]
Definition: lock.c:28
#define _LOCKTAB_LOCK
Definition: mtdll.h:54
#define TRACE(s)
Definition: solgame.cpp:4
static __inline void msvcrt_initialize_mlock(int locknum)
Definition: lock.c:35
void _lock(int locknum)
Definition: lock.c:97

Referenced by _lock(), and mingw_onexit().

◆ _onexit_t()

_onexit_t ( __cdecl __MINGW_IMP_SYMBOL_onexit)

Referenced by atexit(), and mingw_onexit().

◆ _unlock()

void __cdecl _unlock ( int  _File)

Definition at line 126 of file lock.c.

127 {
128  TRACE( "(%d)\n", locknum );
129 
130  LeaveCriticalSection( &(lock_table[ locknum ].crit) );
131 }
static LOCKTABLEENTRY lock_table[_TOTAL_LOCKS]
Definition: lock.c:28
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by _lock(), _unlock_file(), and mingw_onexit().

◆ atexit()

int __cdecl atexit ( _PVFV  func)

Definition at line 56 of file atonexit.c.

57 {
58  return (mingw_onexit((_onexit_t)func) == NULL) ? -1 : 0;
59 }
GLenum func
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
_onexit_t(__cdecl *__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func)
_onexit_t __cdecl mingw_onexit(_onexit_t func)
Definition: atonexit.c:33

Referenced by __do_global_ctors(), main(), and openlog().

◆ mingw_onexit()

_onexit_t __cdecl mingw_onexit ( _onexit_t  func)

Definition at line 33 of file atonexit.c.

34 {
35  _PVFV *onexitbegin;
36  _PVFV *onexitend;
37  _onexit_t retval;
38 
39  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
40 
41  if (onexitbegin == (_PVFV *) -1)
42  return (* __MINGW_IMP_SYMBOL(_onexit)) (func);
44  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
45  onexitend = (_PVFV *) _decode_pointer (__onexitend);
46 
47  retval = __dllonexit (func, &onexitbegin, &onexitend);
48 
49  __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin);
50  __onexitend = (_PVFV *) _encode_pointer (onexitend);
52  return retval;
53 }
#define _EXIT_LOCK1
Definition: atonexit.c:19
GLenum func
Definition: glext.h:6028
void(__cdecl * _PVFV)(void)
Definition: internal.h:33
void __cdecl _lock(int _File)
Definition: lock.c:97
void *__cdecl _encode_pointer(void *)
Definition: mingw_helpers.c:25
_PVFV * __onexitbegin
Definition: atonexit.c:24
_CRTIMP _onexit_t __cdecl __dllonexit(_onexit_t, _PVFV **, _PVFV **)
_onexit_t __cdecl _onexit(_In_opt_ _onexit_t _Func)
_PVFV * __onexitend
Definition: atonexit.c:25
_onexit_t(__cdecl *__MINGW_IMP_SYMBOL(_onexit))(_onexit_t func)
#define __MINGW_IMP_SYMBOL(sym)
Definition: _mingw_mac.h:53
void __cdecl _unlock(int _File)
Definition: lock.c:126
void *__cdecl _decode_pointer(void *)
Definition: mingw_helpers.c:19

Referenced by atexit().

Variable Documentation

◆ __onexitbegin

_PVFV* __onexitbegin

Definition at line 24 of file atonexit.c.

Referenced by mingw_onexit().

◆ __onexitend

_PVFV* __onexitend

Definition at line 25 of file atonexit.c.

Referenced by mingw_onexit().