diff options
| author | Mark Pulford <mark@kyne.com.au> | 2012-01-03 21:47:45 +1030 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:34 +1030 |
| commit | 2d1c3e8674bd208d44f82361c648306c6c0f8149 (patch) | |
| tree | c693f36197bb7b2f9753fcb9d9a27a3dac5db4d5 | |
| parent | c89cc8e243054cd8da22aa52f932471219c9a2e5 (diff) | |
| download | lua-cjson-2d1c3e8674bd208d44f82361c648306c6c0f8149.tar.gz lua-cjson-2d1c3e8674bd208d44f82361c648306c6c0f8149.tar.bz2 lua-cjson-2d1c3e8674bd208d44f82361c648306c6c0f8149.zip | |
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] = { | |||
| 50 | PTHREAD_MUTEX_INITIALIZER | 50 | PTHREAD_MUTEX_INITIALIZER |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | #define ACQUIRE_DTOA_LOCK(n) do { \ | 53 | #define ACQUIRE_DTOA_LOCK(n) do { \ |
| 54 | pthread_mutex_lock(&private_dtoa_lock[n]); \ | 54 | int r = pthread_mutex_lock(&private_dtoa_lock[n]); \ |
| 55 | if (r) { \ | ||
| 56 | fprintf(stderr, "pthread_mutex_lock failed with %d\n", r); \ | ||
| 57 | abort(); \ | ||
| 58 | } \ | ||
| 55 | } while (0) | 59 | } while (0) |
| 56 | 60 | ||
| 57 | #define FREE_DTOA_LOCK(n) do { \ | 61 | #define FREE_DTOA_LOCK(n) do { \ |
| 58 | pthread_mutex_unlock(&private_dtoa_lock[n]); \ | 62 | int r = pthread_mutex_unlock(&private_dtoa_lock[n]); \ |
| 63 | if (r) { \ | ||
| 64 | fprintf(stderr, "pthread_mutex_unlock failed with %d\n", r);\ | ||
| 65 | abort(); \ | ||
| 66 | } \ | ||
| 59 | } while (0) | 67 | } while (0) |
| 60 | 68 | ||
| 61 | #endif /* MULTIPLE_THREADS */ | 69 | #endif /* MULTIPLE_THREADS */ |
