mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Make fixes and improvements
- clock_nanosleep() is now much faster on OpenBSD and NetBSD - Thread joining is now much faster on NetBSD - FreeBSD timestamps are now more accurate - Thread spawning now goes faster on XNU - Clean up the clone() code
This commit is contained in:
parent
aee50b1327
commit
b407327972
47 changed files with 645 additions and 306 deletions
|
@ -34,7 +34,9 @@
|
|||
#include "libc/thread/tls.h"
|
||||
|
||||
int _fork(uint32_t dwCreationFlags) {
|
||||
int ax, dx, parent;
|
||||
struct CosmoTib *tib;
|
||||
struct PosixThread *pt;
|
||||
int ax, dx, tid, parent;
|
||||
BLOCK_SIGNALS;
|
||||
if (__threaded && _weaken(_pthread_onfork_prepare)) {
|
||||
_weaken(_pthread_onfork_prepare)();
|
||||
|
@ -53,9 +55,12 @@ int _fork(uint32_t dwCreationFlags) {
|
|||
parent = __pid;
|
||||
__pid = dx;
|
||||
if (__tls_enabled) {
|
||||
atomic_store_explicit(&__get_tls()->tib_tid,
|
||||
IsLinux() ? dx : sys_gettid(),
|
||||
memory_order_relaxed);
|
||||
tib = __get_tls();
|
||||
tid = IsLinux() ? dx : sys_gettid();
|
||||
atomic_store_explicit(&tib->tib_tid, tid, memory_order_relaxed);
|
||||
if ((pt = (struct PosixThread *)tib->tib_pthread)) {
|
||||
atomic_store_explicit(&pt->ptid, tid, memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
if (__threaded && _weaken(_pthread_onfork_child)) {
|
||||
_weaken(_pthread_onfork_child)();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue