I currently have a pretty simple single-threaded code base.  I'm using
libev with a variety of watchers -- several io watchers, a few asyncs,
and a few periodics.  I am also using signal watchers.

SEGV does not get handled in a way that I would expect, so I wrote a little test for it.

I'm probably missing something obvious, or doing something wrong.

I only want to catch SEGV to produce some debug output, and yes, I understand that I may be dealing with heap corruption, etc.

I can revert to using sigaction directly, I guess.

#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");

}

int main(int argc, char** argv) {
    ev_signal catcher;
    ev_signal_init(&catcher, catchf, SIGSEGV);
    ev_signal_start(ev_default_loop(0), &catcher);

    int* f = (int*)0x0;
    *f = 9;

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

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to