improved error messages when mutex locking/unlocking fails

This commit is contained in:
Fufu Fang 2019-09-03 14:59:30 +01:00
parent c7dfa241d4
commit 656edbf578
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
1 changed files with 4 additions and 4 deletions

View File

@ -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();
}
}