Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add error checking to dtoa locking primitives

  • Loading branch information...
commit 2d1c3e8674bd208d44f82361c648306c6c0f8149 1 parent c89cc8e
@mpx authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 dtoa_config.h
View
16 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 */
Please sign in to comment.
Something went wrong with that request. Please try again.