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

@ -19,6 +19,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/errno.h"
#include "libc/intrin/atomic.h"
#include "libc/thread/posixthread.internal.h"
#include "libc/thread/thread.h"
@ -33,13 +34,17 @@
* @asyncsignalsafe
*/
errno_t pthread_kill(pthread_t thread, int sig) {
int rc, e = errno;
struct PosixThread *pt = (struct PosixThread *)thread;
if (!__tkill(pt->tid, sig, pt->tib)) {
rc = 0;
} else {
rc = errno;
errno = e;
int e, rc, tid;
struct PosixThread *p;
if (!(rc = pthread_getunique_np(thread, &tid))) {
e = errno;
p = (struct PosixThread *)thread;
if (!__tkill(tid, sig, p->tib)) {
rc = 0;
} else {
rc = errno;
errno = e;
}
}
return rc;
}