Hello, I just wondered whether libevent event loop can handle the SIGTERM and SIGQUIT appropriately. Here is the code snippet I am trying to exit the message loop gracefully and brutally:
static void quick_shutdown(evutil_socket_t _, short what, void* ctx) { struct event_base *evb = (struct event_base*) ctx; event_base_loopbreak(evb); } static void graceful_shutdown(evutil_socket_t _, short what, void* ctx) { struct event_base *evb = (struct event_base*) ctx; event_base_loopexit(evb, NULL); } // main() /* signal handling */ struct event *quit = evsignal_new(base, SIGQUIT, graceful_shutdown, base); struct event *term = evsignal_new(base, SIGTERM, quick_shutdown, base); /* message loop */ event_base_dispatch(base); /* cleanup the mess */ event_free(quit); event_free(term); event_base_free(base); return 0; I expect that the process exits the message loop with kill -15 or kill -3. But it never happens. I wonder whether something wrong with my code, or we should not use libevent to handle SIGQUIT and SIGTERM. Thanks, Best regards, Kun *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.