mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +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
|
@ -54,7 +54,6 @@ TEST(getcontext, test) {
|
|||
TEST(getcontext, canReadAndWriteSignalMask) {
|
||||
sigset_t ss, old;
|
||||
volatile int n = 0;
|
||||
__interruptible = true;
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, SIGUSR1);
|
||||
sigprocmask(SIG_SETMASK, &ss, &old);
|
||||
|
@ -72,8 +71,7 @@ TEST(getcontext, canReadAndWriteSignalMask) {
|
|||
}
|
||||
|
||||
void SetGetContext(void) {
|
||||
static int a;
|
||||
a = 0;
|
||||
int a = 0;
|
||||
getcontext(&context);
|
||||
if (!a) {
|
||||
a = 1;
|
||||
|
@ -82,9 +80,6 @@ void SetGetContext(void) {
|
|||
}
|
||||
|
||||
BENCH(getcontext, bench) {
|
||||
__interruptible = false;
|
||||
EZBENCH2("getsetcontext nosig", donothing, SetGetContext());
|
||||
__interruptible = true;
|
||||
EZBENCH2("getsetcontext", donothing, SetGetContext());
|
||||
}
|
||||
|
||||
|
@ -99,10 +94,6 @@ BENCH(swapcontext, bench) {
|
|||
}
|
||||
} else {
|
||||
ready = true;
|
||||
__interruptible = false;
|
||||
EZBENCH2("swapcontextx2 nosig", donothing, swapcontext(&loop, &main));
|
||||
// kprintf("dollar\n");
|
||||
__interruptible = true;
|
||||
EZBENCH2("swapcontextx2", donothing, swapcontext(&loop, &main));
|
||||
// kprintf("dollar\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue