diff options
Diffstat (limited to 'specific.c')
-rw-r--r-- | specific.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -44,14 +44,19 @@ GC_INNER int GC_key_create_inner(tsd ** key_ptr) return 0; } +/* Called with the lock held. */ GC_INNER int GC_setspecific(tsd * key, void * value) { pthread_t self = pthread_self(); int hash_val = HASH(self); - volatile tse * entry = (volatile tse *)MALLOC_CLEAR(sizeof (tse)); + volatile tse * entry; GC_ASSERT(self != INVALID_THREADID); + GC_dont_gc++; /* disable GC */ + entry = (volatile tse *)MALLOC_CLEAR(sizeof(tse)); + GC_dont_gc--; if (0 == entry) return ENOMEM; + pthread_mutex_lock(&(key -> lock)); /* Could easily check for an existing entry here. */ entry -> next = key->hash[hash_val].p; |