summaryrefslogtreecommitdiff
path: root/cleanup.c
diff options
context:
space:
mode:
authorrpj <rpj>1998-10-14 19:51:06 +0000
committerrpj <rpj>1998-10-14 19:51:06 +0000
commit424ca52423ca124e4618e0e7a0dba22ea989ef09 (patch)
treeb63bdf933f381923fe99a09177c4acd07496f5bb /cleanup.c
parent8c4d7f6bc1d365906724c92e4143fa021bf8a757 (diff)
Thu Oct 15 11:53:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* 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.
Diffstat (limited to 'cleanup.c')
-rw-r--r--cleanup.c19
1 files changed, 11 insertions, 8 deletions
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++;
}
}
}