diff options
Diffstat (limited to 'lib/libkse/thread/thr_spec.c')
-rw-r--r-- | lib/libkse/thread/thr_spec.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/libkse/thread/thr_spec.c b/lib/libkse/thread/thr_spec.c index f373d8e..a7c6c2c 100644 --- a/lib/libkse/thread/thr_spec.c +++ b/lib/libkse/thread/thr_spec.c @@ -28,12 +28,14 @@ * * $FreeBSD$ */ + +#include "namespace.h" #include <signal.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <pthread.h> - +#include "un-namespace.h" #include "thr_private.h" @@ -117,8 +119,8 @@ void _thread_cleanupspecific(void) { struct pthread *curthread = _get_curthread(); - void (*destructor)( void *); - void *data = NULL; + const_key_destructor_t destructor; + const void *data = NULL; int key; int i; @@ -137,9 +139,9 @@ _thread_cleanupspecific(void) (curthread->specific[key].data != NULL)) { if (curthread->specific[key].seqno == _thread_keytable[key].seqno) { - data = (void *) - curthread->specific[key].data; - destructor = _thread_keytable[key].destructor; + data = curthread->specific[key].data; + destructor = (const_key_destructor_t) + _thread_keytable[key].destructor; } curthread->specific[key].data = NULL; curthread->specific_data_count--; @@ -201,7 +203,7 @@ _pthread_setspecific(pthread_key_t key, const void *value) pthread->specific_data_count++; } else if (value == NULL) pthread->specific_data_count--; - pthread->specific[key].data = value; + *(const void **)&pthread->specific[key].data = value; pthread->specific[key].seqno = _thread_keytable[key].seqno; ret = 0; @@ -229,7 +231,7 @@ _pthread_getspecific(pthread_key_t key) if (_thread_keytable[key].allocated && (pthread->specific[key].seqno == _thread_keytable[key].seqno)) { /* Return the value: */ - data = (void *) pthread->specific[key].data; + data = pthread->specific[key].data; } else { /* * This key has not been used before, so return NULL |