From 656edbf5781e4f0a78aad960c7ca18686e637fed Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Tue, 3 Sep 2019 14:59:30 +0100 Subject: [PATCH] improved error messages when mutex locking/unlocking fails --- src/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.c b/src/util.c index d3adfbd..1986d75 100644 --- a/src/util.c +++ b/src/util.c @@ -42,8 +42,8 @@ void PTHREAD_MUTEX_UNLOCK(pthread_mutex_t *x) int i; i = pthread_mutex_unlock(x); if (i) { - fprintf(stderr, "pthread_mutex_unlock failed, %d, %s\n", i, - strerror(i)); + fprintf(stderr, "thread %lu: pthread_mutex_unlock() failed, %d, %s\n", + pthread_self(), i, strerror(i)); exit_failure(); } } @@ -53,8 +53,8 @@ void PTHREAD_MUTEX_LOCK(pthread_mutex_t *x) int i; i = pthread_mutex_lock(x); if (i) { - fprintf(stderr, "pthread_mutex_lock failed, %d, %s\n", i, - strerror(i)); + fprintf(stderr, "thread %lu: pthread_mutex_lock() failed, %d, %s\n", + pthread_self(), i, strerror(i)); exit_failure(); } }