]> granicus.if.org Git - gc/commitdiff
Check result of pthread_mutex_unlock in specific.c
authorIvan Maidanski <ivmai@mail.ru>
Wed, 17 Oct 2018 07:21:10 +0000 (10:21 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 26 Nov 2018 06:07:25 +0000 (09:07 +0300)
* specific.c [USE_CUSTOM_SPECIFIC] (GC_setspecific,
GC_remove_specific_after_fork): Call ABORT if pthread_mutex_unlock()
fails.

specific.c

index 624236fdf20d7b27dac4c0cf838b34436dfbab3b..451cf9086ef2fdbc885af25cbbe548f5c04802b3 100644 (file)
@@ -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.   */