summaryrefslogtreecommitdiff
path: root/specific.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-10-17 10:21:10 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-10-17 10:21:10 +0300
commiteb1a9c646a2ad573ebe728d559c4403822881875 (patch)
tree037afc07e3644d8440402a35f8b253060c6ba718 /specific.c
parent85e3083ffcfce99717cd3a786dcab7c7911f6f43 (diff)
downloadbdwgc-eb1a9c646a2ad573ebe728d559c4403822881875.tar.gz
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.
Diffstat (limited to 'specific.c')
-rw-r--r--specific.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/specific.c b/specific.c
index 624236fd..451cf908 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. */