From 2d1c3e8674bd208d44f82361c648306c6c0f8149 Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Tue, 3 Jan 2012 21:47:45 +1030 Subject: Add error checking to dtoa locking primitives --- dtoa_config.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dtoa_config.h b/dtoa_config.h index 294351d..380e83b 100644 --- a/dtoa_config.h +++ b/dtoa_config.h @@ -50,12 +50,20 @@ static pthread_mutex_t private_dtoa_lock[2] = { PTHREAD_MUTEX_INITIALIZER }; -#define ACQUIRE_DTOA_LOCK(n) do { \ - pthread_mutex_lock(&private_dtoa_lock[n]); \ +#define ACQUIRE_DTOA_LOCK(n) do { \ + int r = pthread_mutex_lock(&private_dtoa_lock[n]); \ + if (r) { \ + fprintf(stderr, "pthread_mutex_lock failed with %d\n", r); \ + abort(); \ + } \ } while (0) -#define FREE_DTOA_LOCK(n) do { \ - pthread_mutex_unlock(&private_dtoa_lock[n]); \ +#define FREE_DTOA_LOCK(n) do { \ + int r = pthread_mutex_unlock(&private_dtoa_lock[n]); \ + if (r) { \ + fprintf(stderr, "pthread_mutex_unlock failed with %d\n", r);\ + abort(); \ + } \ } while (0) #endif /* MULTIPLE_THREADS */ -- cgit v1.2.3-55-g6feb