diff options
Diffstat (limited to 'libc/stdlib/abort.c')
-rw-r--r-- | libc/stdlib/abort.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index a940768c0..6e1806eae 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -49,12 +49,8 @@ extern void weak_function _stdio_term(void) attribute_hidden; static int been_there_done_that = 0; /* Be prepared in case multiple threads try to abort() */ -#ifdef __UCLIBC_HAS_THREADS__ -# include <pthread.h> -static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -#endif -#define LOCK __pthread_mutex_lock(&mylock) -#define UNLOCK __pthread_mutex_unlock(&mylock) +#include <bits/uClibc_mutex.h> +__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); /* Cause an abnormal program termination with core-dump */ void abort(void) @@ -62,7 +58,7 @@ void abort(void) sigset_t sigs; /* Make sure we acquire the lock before proceeding */ - LOCK; + __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(mylock); /* Unmask SIGABRT to be sure we can get it */ if (__sigemptyset(&sigs) == 0 && __sigaddset(&sigs, SIGABRT) == 0) { @@ -85,9 +81,9 @@ void abort(void) #endif abort_it: - UNLOCK; + __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(mylock); raise(SIGABRT); - LOCK; + __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(mylock); } /* Still here? Try to remove any signal handlers */ |