From eb1a9c646a2ad573ebe728d559c4403822881875 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 17 Oct 2018 10:21:10 +0300 Subject: [PATCH] Check result of pthread_mutex_unlock in specific.c * specific.c [USE_CUSTOM_SPECIFIC] (GC_setspecific, GC_remove_specific_after_fork): Call ABORT if pthread_mutex_unlock() fails. --- specific.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/specific.c b/specific.c index 624236f..451cf90 100644 --- a/specific.c +++ b/specific.c @@ -72,7 +72,8 @@ GC_INNER int GC_setspecific(tsd * key, void * value) AO_store_release(&key->hash[hash_val].ao, (AO_t)entry); GC_dirty((/* no volatile */ void *)entry); GC_dirty(key->hash + hash_val); - pthread_mutex_unlock(&(key -> lock)); + if (pthread_mutex_unlock(&key->lock) != 0) + ABORT("pthread_mutex_unlock failed (setspecific)"); return 0; } @@ -128,7 +129,8 @@ GC_INNER void GC_remove_specific_after_fork(tsd * key, pthread_t t) /* With GC, we're done, since the pointers from the cache will */ /* be overwritten, all local pointers to the entries will be */ /* dropped, and the entry will then be reclaimed. */ - pthread_mutex_unlock(&(key -> lock)); + if (pthread_mutex_unlock(&key->lock) != 0) + ABORT("pthread_mutex_unlock failed (remove_specific after fork)"); } /* Note that even the slow path doesn't lock. */ -- 2.7.4