mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Make posix_spawn faster on Windows
This commit is contained in:
parent
d6f72aa4a6
commit
ec957491ea
15 changed files with 514 additions and 123 deletions
|
@ -21,6 +21,8 @@
|
|||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/sysv/consts/sicode.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
|
@ -62,10 +64,20 @@ int raise(int sig) {
|
|||
RaiseSigFpe();
|
||||
rc = 0;
|
||||
#endif
|
||||
} else if (!IsWindows() && !IsMetal()) {
|
||||
} else if (IsLinux() || IsXnu() || IsFreebsd() || IsOpenbsd() || IsNetbsd()) {
|
||||
rc = sys_tkill(gettid(), sig, 0);
|
||||
} else if (IsWindows() || IsMetal()) {
|
||||
if (IsWindows() && sig == SIGKILL) {
|
||||
// TODO(jart): Isn't this implemented by __sig_raise()?
|
||||
if (_weaken(__restore_console_win32)) {
|
||||
_weaken(__restore_console_win32)();
|
||||
}
|
||||
ExitProcess(sig);
|
||||
} else {
|
||||
rc = __sig_raise(sig, SI_TKILL);
|
||||
}
|
||||
} else {
|
||||
rc = __sig_raise(sig, SI_TKILL);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
STRACE("...raise(%G) → %d% m", sig, rc);
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue