Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpx/lua-cjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2012-01-03 15:17:45 +0400
committerMark Pulford <mark@kyne.com.au>2012-03-04 12:24:34 +0400
commit2d1c3e8674bd208d44f82361c648306c6c0f8149 (patch)
treec693f36197bb7b2f9753fcb9d9a27a3dac5db4d5
parentc89cc8e243054cd8da22aa52f932471219c9a2e5 (diff)
Add error checking to dtoa locking primitives
-rw-r--r--dtoa_config.h16
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 */