Make _Thread_local more seamlessly working

This commit is contained in:
Justine Tunney 2022-07-10 08:27:50 -07:00
parent 5f4f6b0e69
commit 5fa77f1e8f
23 changed files with 217 additions and 283 deletions

View file

@ -23,8 +23,6 @@
#include "libc/thread/internal.h"
#include "libc/thread/thread.h"
STATIC_YOINK("_main_thread_ctor");
/**
* Allocates TLS slot.
*/
@ -43,7 +41,7 @@ int pthread_key_create(pthread_key_t *key, pthread_key_dtor dtor) {
}
static textexit void _pthread_key_atexit(void) {
_pthread_key_destruct(((cthread_t)__get_tls())->key);
_pthread_key_destruct(_pthread_keys);
}
__attribute__((__constructor__)) static textstartup void _pthread_key_init() {