mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Make forking off threads reliable on Windows
This change makes posix_spawn_test no longer flaky on Windows, by (1) fixing a race condition in wait(), and (2) removing a misguided vfork implementation which was letting Windows bypass pthread_atfork().
This commit is contained in:
parent
2ebc5781a1
commit
58352df0a4
30 changed files with 230 additions and 187 deletions
|
@ -37,8 +37,7 @@
|
|||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
textwindows int __wsablock(struct Fd *fd, struct NtOverlapped *overlapped,
|
||||
uint32_t *flags, bool restartable,
|
||||
uint32_t timeout) {
|
||||
uint32_t *flags, int sigops, uint32_t timeout) {
|
||||
int e, rc;
|
||||
uint32_t i, got;
|
||||
if (WSAGetLastError() != kNtErrorIoPending) {
|
||||
|
@ -51,7 +50,7 @@ textwindows int __wsablock(struct Fd *fd, struct NtOverlapped *overlapped,
|
|||
WSAGetLastError() == kNtErrorNotFound);
|
||||
errno = e;
|
||||
} else {
|
||||
if (_check_interrupts(restartable, g_fds.p)) {
|
||||
if (_check_interrupts(sigops, g_fds.p)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +61,7 @@ textwindows int __wsablock(struct Fd *fd, struct NtOverlapped *overlapped,
|
|||
NTTRACE("WSAWaitForMultipleEvents failed %lm");
|
||||
return __winsockerr();
|
||||
} else if (i == kNtWaitTimeout || i == kNtWaitIoCompletion) {
|
||||
if (_check_interrupts(restartable, g_fds.p)) {
|
||||
if (_check_interrupts(sigops, g_fds.p)) {
|
||||
return -1;
|
||||
}
|
||||
if (timeout) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue