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:
Justine Tunney 2022-11-08 10:09:47 -08:00
parent aee50b1327
commit b407327972
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
47 changed files with 645 additions and 306 deletions

View file

@ -24,6 +24,7 @@
#include "libc/fmt/itoa.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/asmflag.h"
#include "libc/intrin/atomic.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/pr.h"
@ -31,12 +32,13 @@
static errno_t pthread_setname_impl(pthread_t thread, const char *name) {
char path[128], *p;
int fd, rc, tid, len, e = errno;
int e, fd, rc, tid, len;
tid = ((struct PosixThread *)thread)->tid;
if ((rc = pthread_getunique_np(thread, &tid))) return rc;
len = strlen(name);
if (IsLinux()) {
e = errno;
if (tid == gettid()) {
if (prctl(PR_SET_NAME, name) == -1) {
rc = errno;