mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Make garbage collection thread safe
- You can now use _gc(malloc()) in multithreaded programs - This change fixes a bug where fork() on NT disabled TLS - Fixed TLS code morphing on XNU/NT, for R8-R15 registers
This commit is contained in:
parent
571c2c3c69
commit
0e2b1bfeed
37 changed files with 310 additions and 189 deletions
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/pthread.h"
|
||||
#include "libc/nexgen32e/gettls.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/thread/posixthread.internal.h"
|
||||
#include "libc/thread/spawn.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
@ -38,7 +39,7 @@ wontreturn void pthread_exit(void *rc) {
|
|||
struct PosixThread *pt;
|
||||
if ((pt = ((cthread_t)__get_tls())->pthread)) {
|
||||
pt->rc = rc;
|
||||
longjmp(pt->exiter, 1);
|
||||
_gclongjmp(pt->exiter, 1);
|
||||
} else {
|
||||
_Exit1((int)(intptr_t)rc);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue