From 424ca52423ca124e4618e0e7a0dba22ea989ef09 Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 14 Oct 1998 19:51:06 +0000 Subject: Thu Oct 15 11:53:21 1998 Ross Johnson * global.c (_pthread_tsd_key_table): Fix declaration. * implement.h(_pthread_TSD_keys_TlsIndex): Add missing extern. (_pthread_tsd_mutex): Ditto. * create.c (_pthread_start_call): Fix "keys" array declaration. Add comment. * tsd.c (pthread_setspecific): Fix type declaration and cast. (pthread_getspecific): Ditto. * cleanup.c (_pthread_destructor_run_all): Declare missing loop counter. --- cleanup.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'cleanup.c') diff --git a/cleanup.c b/cleanup.c index c956ce7..936e6e1 100644 --- a/cleanup.c +++ b/cleanup.c @@ -125,31 +125,34 @@ _pthread_handler_pop_all(int stack, int execute) void _pthread_destructor_run_all() { - _pthread_tsd_key_t * k; + _pthread_tsd_key_t * key; void * arg; int count; - k = _pthread_tsd_key_table; + /* This threads private keys */ + key = _pthread_tsd_key_table; /* Stop destructor execution at a finite time. POSIX allows us to ignore this if we like, even at the risk of an infinite loop. */ for (count = 0; count < PTHREAD_DESTRUCTOR_ITERATIONS; count++) { + int k; + /* Loop through all keys. */ - for (key = 0; key < _POSIX_THREAD_KEYS_MAX; key++) + for (k = 0; k < _POSIX_THREAD_KEYS_MAX; k++) { - if (k->in_use != 1) + if (key->in_use != _PTHREAD_TSD_KEY_INUSE) continue; - arg = pthread_getspecific(key); + arg = pthread_getspecific((pthread_key_t) k); - if (arg != NULL && k->destructor != NULL) + if (arg != NULL && key->destructor != NULL) { - (void) (k->destructor)(arg); + (void) (key->destructor)(arg); } - k++; + key++; } } } -- cgit v1.2.3