mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Make _Thread_local more seamlessly working
This commit is contained in:
parent
5f4f6b0e69
commit
5fa77f1e8f
23 changed files with 217 additions and 283 deletions
|
@ -18,16 +18,15 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/errno.h"
|
||||
#include "libc/nexgen32e/gettls.h"
|
||||
#include "libc/thread/internal.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
||||
STATIC_YOINK("_main_thread_ctor");
|
||||
|
||||
/**
|
||||
* Gets value of TLS slot for current thread.
|
||||
*/
|
||||
void *pthread_getspecific(pthread_key_t key) {
|
||||
if (key < PTHREAD_KEYS_MAX) {
|
||||
return ((cthread_t)__get_tls_inline())->key[key];
|
||||
if (0 <= key && key < PTHREAD_KEYS_MAX) {
|
||||
return _pthread_keys[key];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue