mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Make _Thread_local work across platforms
We now rewrite the binary image at runtime on Windows and XNU to change mov %fs:0,%reg instructions to use %gs instead. There's also simpler threading API introduced by this change and it's called _spawn() and _join(), which has replaced most clone() usage.
This commit is contained in:
parent
e4d6e263d4
commit
5f4f6b0e69
51 changed files with 808 additions and 1043 deletions
20
libc/thread/spawn.h
Normal file
20
libc/thread/spawn.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_THREAD_SPAWN_H_
|
||||
#define COSMOPOLITAN_LIBC_THREAD_SPAWN_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct spawn {
|
||||
int ptid;
|
||||
int *ctid;
|
||||
char *stk;
|
||||
char *tls;
|
||||
char *tib;
|
||||
};
|
||||
|
||||
int _spawn(int (*)(void *, int), void *, struct spawn *) hidden;
|
||||
int _join(struct spawn *) hidden;
|
||||
char *_mktls(char **) hidden;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_THREAD_SPAWN_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue