mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Implement raise() with getcontext() / setcontext()
This commit is contained in:
parent
dd83db9567
commit
736fdb757a
12 changed files with 73 additions and 97 deletions
|
@ -479,13 +479,6 @@ static int __sigaction(int sig, const struct sigaction *act,
|
|||
* spawned your process, happened to call `setrlimit()`. Doing this is
|
||||
* a wonderful idea.
|
||||
*
|
||||
* Using signals might make your C runtime slower. Upon successfully
|
||||
* installing its first signal handling function, sigaction() will set
|
||||
* the global variable `__interruptible` to true, to let everything else
|
||||
* know that signals are in play. That way code which would otherwise be
|
||||
* frequently calling sigprocmask() out of an abundance of caution, will
|
||||
* no longer need to pay its outrageous cost.
|
||||
*
|
||||
* Signal handlers should avoid clobbering global variables like `errno`
|
||||
* because most signals are asynchronous, i.e. the signal handler might
|
||||
* be called at any assembly instruction. If something like a `SIGCHLD`
|
||||
|
@ -506,13 +499,6 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oldact) {
|
|||
rc = einval();
|
||||
} else {
|
||||
rc = __sigaction(sig, act, oldact);
|
||||
if (!rc && act && (uintptr_t)act->sa_handler >= kSigactionMinRva) {
|
||||
static bool once;
|
||||
if (!once) {
|
||||
__interruptible = true;
|
||||
once = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
STRACE("sigaction(%G, %s, [%s]) → %d% m", sig, DescribeSigaction(0, act),
|
||||
DescribeSigaction(rc, oldact), rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue