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

@ -23,6 +23,7 @@
#include "libc/errno.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/asmflag.h"
#include "libc/intrin/atomic.h"
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
@ -30,11 +31,12 @@
#include "libc/thread/posixthread.internal.h"
static errno_t pthread_getname_impl(pthread_t thread, char *name, size_t size) {
int fd, rc, tid, len, e = errno;
int e, fd, rc, tid, len;
if ((rc = pthread_getunique_np(thread, &tid))) return rc;
if (!size) return 0;
bzero(name, size);
tid = ((struct PosixThread *)thread)->tid;
e = errno;
if (IsLinux()) {
// TASK_COMM_LEN is 16 on Linux so we're just being paranoid.