Implement raise() with getcontext() / setcontext()

This commit is contained in:
Justine Tunney 2023-11-05 17:52:30 -08:00
parent dd83db9567
commit 736fdb757a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
12 changed files with 73 additions and 97 deletions

View file

@ -24,8 +24,6 @@
int __tailcontext(const ucontext_t *);
static int __contextmask(const sigset_t *opt_set, sigset_t *opt_out_oldset) {
if (!__interruptible) return 0;
// signal handling functions might exist
// now context switching needs to go 14x slower
return sigprocmask(SIG_SETMASK, opt_set, opt_out_oldset);
}
@ -33,12 +31,6 @@ static int __contextmask(const sigset_t *opt_set, sigset_t *opt_out_oldset) {
/**
* Sets machine context.
*
* This function goes 14x slower if sigaction() has ever been used to
* install a signal handling function. If you don't care about signal
* safety and just want fast fibers, then you may override the global
* variable `__interruptible` to disable the sigprocmask() calls, for
* pure userspace context switching.
*
* @return -1 on error w/ errno, otherwise won't return unless sent back
* @see swapcontext()
* @see makecontext()