From 6b4686a534c10cc9011c9d352d1b57d5a76d5579 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 2 Apr 2003 03:51:24 +0000 Subject: Update. 2003-04-01 Ulrich Drepper * pthread_create.c (deallocate_tsd): Clear/free memory after the last round, not the first. Use specific_used flag instead of local found_nonzero variable. Use THREAD_[SG]ETMEM where possible. (__free_tcb): Don't call deallocate_tsd here. (start_thread): Call deallocate_tsd here. * pthread_setspecific.c: Set specific_used flag really only when needed. * Makefile (tests): Add tst-tsd3.c * tst-tsd3.c: New file. --- nptl/pthread_setspecific.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'nptl/pthread_setspecific.c') diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c index baca804..b6e66b5 100644 --- a/nptl/pthread_setspecific.c +++ b/nptl/pthread_setspecific.c @@ -45,6 +45,10 @@ __pthread_setspecific (key, value) return EINVAL; level2 = &self->specific_1stblock[key]; + + /* Remember that we stored at least one set of data. */ + if (value != NULL) + THREAD_SETMEM (self, specific_used, true); } else { @@ -76,6 +80,9 @@ __pthread_setspecific (key, value) /* Pointer to the right array element. */ level2 = &level2[idx2nd]; + + /* Remember that we stored at least one set of data. */ + THREAD_SETMEM (self, specific_used, true); } /* Store the data and the sequence number so that we can recognize @@ -83,9 +90,6 @@ __pthread_setspecific (key, value) level2->seq = seq; level2->data = (void *) value; - /* Remember that we stored at least one set of data. */ - THREAD_SETMEM (self, specific_used, true); - return 0; } strong_alias (__pthread_setspecific, pthread_setspecific) -- cgit v1.1