mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +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
|
@ -87,7 +87,7 @@ static void ListenForSigThr(void) {
|
|||
*
|
||||
* By default, pthread_cancel() can only take effect when a thread
|
||||
* reaches a cancellation point. Such functions are documented with
|
||||
* @cancellationpoint. They check the cancellation state before the
|
||||
* `@cancellationpoint`. They check the cancellation state before the
|
||||
* underlying system call is issued. If the system call is issued and
|
||||
* blocks, then pthread_cancel() will interrupt the operation in which
|
||||
* case the syscall wrapper will check the cancelled state a second
|
||||
|
@ -277,18 +277,20 @@ errno_t pthread_cancel(pthread_t thread) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
if (IsWindows()) return 0; // no true cancellations on Windows yet
|
||||
tid = atomic_load_explicit(&pt->tib->tib_tid, memory_order_acquire);
|
||||
if (tid <= 0) return 0; // -1 means still starting, 0 means exited
|
||||
e = errno;
|
||||
if (!__tkill(tid, SIGTHR, pt->tib)) {
|
||||
return 0;
|
||||
} else {
|
||||
rc = errno;
|
||||
errno = e;
|
||||
return rc;
|
||||
if (!(rc = pthread_getunique_np(thread, &tid))) {
|
||||
if (!IsWindows()) {
|
||||
e = errno;
|
||||
if (!__tkill(tid, SIGTHR, pt->tib)) {
|
||||
rc = 0;
|
||||
} else {
|
||||
rc = errno;
|
||||
errno = e;
|
||||
}
|
||||
} else {
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue