From cff67f93caeb3f98261860904dd232f6b551299e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 28 Feb 2019 00:02:41 +0100 Subject: fix crashes --- src/std/thread.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/std/thread.c') diff --git a/src/std/thread.c b/src/std/thread.c index f717865..4f27c1d 100644 --- a/src/std/thread.c +++ b/src/std/thread.c @@ -101,33 +101,37 @@ int amal_mutex_lock(amal_mutex *self, const char *lock_identifier) { int result; result = pthread_mutex_lock(&self->mutex); self->lock_identifier = lock_identifier; + #ifdef AMAL_MUTEX_DEBUG if(result == 0 && self->lock_identifier) { amal_log_debug("amal_mutex_lock: mutex locked by thread %lu (%s), identification: %s", amal_thread_get_id(), amal_thread_is_main() ? "main" : "not main", self->lock_identifier ? self->lock_identifier : "none"); } + #endif return result; } int amal_mutex_unlock(amal_mutex *self) { int result; + #ifdef AMAL_MUTEX_DEBUG const char *identifier; identifier = self->lock_identifier; + #endif result = pthread_mutex_unlock(&self->mutex); + #ifdef AMAL_MUTEX_DEBUG if(result == 0 && identifier) { amal_log_debug("amal_mutex_unlock: mutex unlocked by thread %lu (%s), identification: %s", amal_thread_get_id(), amal_thread_is_main() ? "main" : "not main", identifier ? identifier : "none"); } + #endif return result; } void amal_mutex_tryunlock(amal_mutex *self) { - int _; - (void)_; - _ = amal_mutex_unlock(self); + ignore_result_int(amal_mutex_unlock(self)); } bool amal_thread_is_main() { -- cgit v1.2.3