Signal problem

Tim McClarren tim at idle-games.com
Thu Jan 7 19:26:41 CET 2010


Mea culpa.  In trying to create a minimal reproduction case, I botched.

Here's a better case:

#include <ev.h>
#include <stdio.h>

void catchf(struct ev_loop* loop, ev_signal* w, int r) {
     ev_unloop(ev_default_loop(0), EVUNLOOP_ALL);
     printf("caught SEGV\n");

}

void laterf(struct ev_loop* loop, ev_periodic* p, int r) {
     printf("triggering SEGV\n");
     int* f = (int*)0x0;
     *f = 9;
}

int main(int argc, char** argv) {
     ev_signal catcher;
     ev_periodic later;

     ev_signal_init(&catcher, catchf, SIGSEGV);
     ev_periodic_init(&later, laterf, 0, 3, NULL);
     ev_signal_start(ev_default_loop(0), &catcher);
     ev_periodic_start(ev_default_loop(0), &later);
     ev_loop(ev_default_loop(0), 0);

     printf("loop exited\n");
     return 0;
}





More information about the libev mailing list