2010-04-06 Dave Korn <dave.korn.cygwin@googlemail.com>

* libc/stdlib/__atexit.c (__atexit_lock): Initialise as recursive
        rather than non-recursive lock type.
        (__register_exitproc): Use recursive locking APIs on it.
        * libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise.
This commit is contained in:
Jeff Johnston 2010-04-06 20:20:36 +00:00
parent 385b0add19
commit 5f46e4094f
3 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2010-04-06 Dave Korn <dave.korn.cygwin@googlemail.com>
* libc/stdlib/__atexit.c (__atexit_lock): Initialise as recursive
rather than non-recursive lock type.
(__register_exitproc): Use recursive locking APIs on it.
* libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise.
2010-04-06 Corinna Vinschen <corinna@vinschen.de> 2010-04-06 Corinna Vinschen <corinna@vinschen.de>
* libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect * libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect

View File

@ -10,7 +10,7 @@
/* Make this a weak reference to avoid pulling in malloc. */ /* Make this a weak reference to avoid pulling in malloc. */
void * malloc(size_t) _ATTRIBUTE((__weak__)); void * malloc(size_t) _ATTRIBUTE((__weak__));
__LOCK_INIT(, __atexit_lock); __LOCK_INIT_RECURSIVE(, __atexit_lock);
/* /*
* Register a function to be performed at exit or on shared library unload. * Register a function to be performed at exit or on shared library unload.
@ -28,7 +28,7 @@ _DEFUN (__register_exitproc,
register struct _atexit *p; register struct _atexit *p;
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_acquire(__atexit_lock); __lock_acquire_recursive(__atexit_lock);
#endif #endif
p = _GLOBAL_REENT->_atexit; p = _GLOBAL_REENT->_atexit;
@ -48,7 +48,7 @@ _DEFUN (__register_exitproc,
if (p == NULL) if (p == NULL)
{ {
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_release(__atexit_lock); __lock_release_recursive(__atexit_lock);
#endif #endif
return -1; return -1;
} }
@ -93,7 +93,7 @@ _DEFUN (__register_exitproc,
} }
p->_fns[p->_ind++] = fn; p->_fns[p->_ind++] = fn;
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_release(__atexit_lock); __lock_release_recursive(__atexit_lock);
#endif #endif
return 0; return 0;
} }

View File

@ -33,7 +33,7 @@ _DEFUN (__call_exitprocs, (code, d),
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_acquire(__atexit_lock); __lock_acquire_recursive(__atexit_lock);
#endif #endif
restart: restart:
@ -115,7 +115,7 @@ _DEFUN (__call_exitprocs, (code, d),
#endif #endif
} }
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_release(__atexit_lock); __lock_release_recursive(__atexit_lock);
#endif #endif
} }