diff options
Diffstat (limited to 'newlib/libc/stdlib/__atexit.c')
-rw-r--r-- | newlib/libc/stdlib/__atexit.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index 4f0b67c9e..b68d80f9c 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -10,6 +10,7 @@ /* Make this a weak reference to avoid pulling in malloc. */ void * malloc(size_t) _ATTRIBUTE((__weak__)); +__LOCK_INIT(, __atexit_lock); /* * Register a function to be performed at exit or on shared library unload. @@ -27,9 +28,7 @@ _DEFUN (__register_exitproc, register struct _atexit *p; #ifndef __SINGLE_THREAD__ - __LOCK_INIT(static, lock); - - __lock_acquire(lock); + __lock_acquire(__atexit_lock); #endif p = _GLOBAL_REENT->_atexit; @@ -49,7 +48,7 @@ _DEFUN (__register_exitproc, if (p == NULL) { #ifndef __SINGLE_THREAD__ - __lock_release(lock); + __lock_release(__atexit_lock); #endif return -1; } @@ -94,7 +93,7 @@ _DEFUN (__register_exitproc, } p->_fns[p->_ind++] = fn; #ifndef __SINGLE_THREAD__ - __lock_release(lock); + __lock_release(__atexit_lock); #endif return 0; } |