Update sample/signal-test.c to use newer APIs and not leak.

This commit is contained in:
Evan Jones 2009-12-08 17:02:24 -05:00 committed by Nick Mathewson
parent ea6b1df288
commit f6430ac1e3

View File

@ -49,6 +49,7 @@ int
main (int argc, char **argv)
{
struct event signal_int;
struct event_base* base;
#ifdef WIN32
WORD wVersionRequested;
WSADATA wsaData;
@ -60,15 +61,16 @@ main (int argc, char **argv)
#endif
/* Initalize the event library */
event_init();
base = event_base_new();
/* Initalize one event */
event_set(&signal_int, SIGINT, EV_SIGNAL|EV_PERSIST, signal_cb,
event_assign(&signal_int, base, SIGINT, EV_SIGNAL|EV_PERSIST, signal_cb,
&signal_int);
event_add(&signal_int, NULL);
event_dispatch();
event_base_dispatch(base);
event_base_free(base);
return (0);
}