diff options
author | Mark Pulford <mark@kyne.com.au> | 2012-01-03 15:17:45 +0400 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 12:24:34 +0400 |
commit | 2d1c3e8674bd208d44f82361c648306c6c0f8149 (patch) | |
tree | c693f36197bb7b2f9753fcb9d9a27a3dac5db4d5 | |
parent | c89cc8e243054cd8da22aa52f932471219c9a2e5 (diff) |
Add error checking to dtoa locking primitives
-rw-r--r-- | dtoa_config.h | 16 |
1 files 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 */ |