mirror of
https://github.com/fluencelabs/musl
synced 2025-06-25 20:51:53 +00:00
simplify pthread tsd key handling
This commit is contained in:
@ -9,7 +9,7 @@ struct __libc {
|
|||||||
void (*cancelpt)(int);
|
void (*cancelpt)(int);
|
||||||
void (*lock)(volatile int *);
|
void (*lock)(volatile int *);
|
||||||
void (*lockfile)(FILE *);
|
void (*lockfile)(FILE *);
|
||||||
void (**tsd_keys)(void *);
|
void (*fork_handler)(int);
|
||||||
void (*sigtimer)();
|
void (*sigtimer)();
|
||||||
int (*atexit)(void (*)(void));
|
int (*atexit)(void (*)(void));
|
||||||
void (*fini)(void);
|
void (*fini)(void);
|
||||||
@ -17,7 +17,6 @@ struct __libc {
|
|||||||
volatile int threads_minus_1;
|
volatile int threads_minus_1;
|
||||||
int ofl_lock;
|
int ofl_lock;
|
||||||
int (*rsyscall)(int, long, long, long, long, long, long);
|
int (*rsyscall)(int, long, long, long, long, long, long);
|
||||||
void (*fork_handler)(int);
|
|
||||||
FILE *ofl_head;
|
FILE *ofl_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ int pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
|
|||||||
unsigned j = i;
|
unsigned j = i;
|
||||||
|
|
||||||
pthread_self();
|
pthread_self();
|
||||||
libc.tsd_keys = keys;
|
|
||||||
if (!dtor) dtor = nodtor;
|
if (!dtor) dtor = nodtor;
|
||||||
do {
|
do {
|
||||||
if (!a_cas_p(keys+j, 0, dtor)) {
|
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;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pthread_key_delete(pthread_key_t k)
|
||||||
|
{
|
||||||
|
keys[k] = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void __pthread_tsd_run_dtors(pthread_t self)
|
void __pthread_tsd_run_dtors(pthread_t self)
|
||||||
{
|
{
|
||||||
int i, j, not_finished = self->tsd_used;
|
int i, j, not_finished = self->tsd_used;
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#include "pthread_impl.h"
|
|
||||||
|
|
||||||
int pthread_key_delete(pthread_key_t k)
|
|
||||||
{
|
|
||||||
libc.tsd_keys[k] = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
Reference in New Issue
Block a user