diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-04-03 02:40:18 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-04-03 02:40:18 -0400 |
commit | 537d33d33478034b62928e5cacf397b049ac78ab (patch) | |
tree | cb84cb705253897a38c1025971990ebbd6cd7f5c | |
parent | fd80cfa00b34ec81b3049b98c66f6a45301ca6c4 (diff) | |
download | musl-537d33d33478034b62928e5cacf397b049ac78ab.tar.gz musl-537d33d33478034b62928e5cacf397b049ac78ab.tar.xz musl-537d33d33478034b62928e5cacf397b049ac78ab.zip |
simplify pthread tsd key handling
-rw-r--r-- | src/internal/libc.h | 3 | ||||
-rw-r--r-- | src/thread/pthread_key_create.c | 7 | ||||
-rw-r--r-- | src/thread/pthread_key_delete.c | 7 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/internal/libc.h b/src/internal/libc.h index 60a25eff..6828f8b6 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -9,7 +9,7 @@ struct __libc { void (*cancelpt)(int); void (*lock)(volatile int *); void (*lockfile)(FILE *); - void (**tsd_keys)(void *); + void (*fork_handler)(int); void (*sigtimer)(); int (*atexit)(void (*)(void)); void (*fini)(void); @@ -17,7 +17,6 @@ struct __libc { volatile int threads_minus_1; int ofl_lock; int (*rsyscall)(int, long, long, long, long, long, long); - void (*fork_handler)(int); FILE *ofl_head; }; diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c index 2316a46f..fa8a6541 100644 --- a/src/thread/pthread_key_create.c +++ b/src/thread/pthread_key_create.c @@ -15,7 +15,6 @@ int pthread_key_create(pthread_key_t *k, void (*dtor)(void *)) unsigned j = i; pthread_self(); - libc.tsd_keys = keys; if (!dtor) dtor = nodtor; do { if (!a_cas_p(keys+j, 0, dtor)) { @@ -26,6 +25,12 @@ int pthread_key_create(pthread_key_t *k, void (*dtor)(void *)) return EAGAIN; } +int pthread_key_delete(pthread_key_t k) +{ + keys[k] = 0; + return 0; +} + void __pthread_tsd_run_dtors(pthread_t self) { int i, j, not_finished = self->tsd_used; diff --git a/src/thread/pthread_key_delete.c b/src/thread/pthread_key_delete.c deleted file mode 100644 index de964567..00000000 --- a/src/thread/pthread_key_delete.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "pthread_impl.h" - -int pthread_key_delete(pthread_key_t k) -{ - libc.tsd_keys[k] = 0; - return 0; -} |