From 89e66ca7e4626344b74ff848e0c307c1870201f2 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 25 May 2018 10:12:56 +0300 Subject: Hide value stored to thread-specific entries for a test purpose * include/private/specific.h (ts_entry_value_t): New type. * include/private/specific.h (TS_HIDE_VALUE, TS_REVEAL_PTR): New macro. * include/private/specific.h (thread_specific_entry): Replace void* to ts_entry_value_t (for value). * include/private/specific.h (GC_getspecific): Apply TS_REVEAL_PTR to entry->value. * specific.c [USE_CUSTOM_SPECIFIC] (GC_slow_getspecific): Likewise. * specific.c [USE_CUSTOM_SPECIFIC] (GC_setspecific): Apply TS_HIDE_VALUE to value stored to entry. --- specific.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'specific.c') diff --git a/specific.c b/specific.c index f17d3254..624236fd 100644 --- a/specific.c +++ b/specific.c @@ -65,7 +65,7 @@ GC_INNER int GC_setspecific(tsd * key, void * value) /* Could easily check for an existing entry here. */ entry -> next = key->hash[hash_val].p; entry -> thread = self; - entry -> value = value; + entry -> value = TS_HIDE_VALUE(value); GC_ASSERT(entry -> qtid == INVALID_QTID); /* There can only be one writer at a time, but this needs to be */ /* atomic with respect to concurrent readers. */ @@ -153,7 +153,7 @@ GC_INNER void * GC_slow_getspecific(tsd * key, word qtid, *cache_ptr = entry; /* Again this is safe since pointer assignments are */ /* presumed atomic, and either pointer is valid. */ - return entry -> value; + return TS_REVEAL_PTR(entry -> value); } #ifdef GC_ASSERTIONS -- cgit v1.2.1