From: Niels Provos Date: Tue, 22 Feb 2005 15:47:53 +0000 (+0000) Subject: provide maintainer mode in automake; put event_gotsig back into global X-Git-Tag: release-1.1b~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=905ee67d0032eb86e4de37878c45cc4bd67cda47;p=libevent provide maintainer mode in automake; put event_gotsig back into global state; return proper error code svn:r131 --- diff --git a/configure.in b/configure.in index f4a26b70..52c2a3ef 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl configure.in for libevent dnl Dug Song AC_INIT(event.c) -AM_INIT_AUTOMAKE(libevent,1.0) +AM_INIT_AUTOMAKE(libevent,1.0b) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/event-internal.h b/event-internal.h index 4f365955..becb6691 100644 --- a/event-internal.h +++ b/event-internal.h @@ -37,9 +37,6 @@ struct event_base { int event_count; /* counts number of total events */ int event_count_active; /* counts number of active events */ - /* Handle signals - This is a deprecated interface */ - int (*event_sigcb)(void); /* Signal callback when gotsig is set */ - int event_gotsig; /* Set in signal handler */ int event_gotterm; /* Set to terminate loop */ /* active event management */ diff --git a/event.c b/event.c index 45d91a4a..2df71c88 100644 --- a/event.c +++ b/event.c @@ -115,6 +115,10 @@ struct event_list signalqueue; struct event_base *current_base = NULL; +/* Handle signals - This is a deprecated interface */ +int (*event_sigcb)(void); /* Signal callback when gotsig is set */ +int event_gotsig; /* Set in signal handler */ + /* Prototypes */ static void event_queue_insert(struct event_base *, struct event *, int); static void event_queue_remove(struct event_base *, struct event *, int); @@ -153,8 +157,8 @@ event_init(void) if ((current_base = calloc(1, sizeof(struct event_base))) == NULL) err(1, "%s: calloc"); - current_base->event_sigcb = NULL; - current_base->event_gotsig = 0; + event_sigcb = NULL; + event_gotsig = 0; gettimeofday(¤t_base->event_tv, NULL); #if defined(USE_LOG) && defined(USE_DEBUG) @@ -328,10 +332,11 @@ event_base_loop(struct event_base *base, int flags) break; } - while (base->event_gotsig) { - base->event_gotsig = 0; - if (base->event_sigcb) { - res = (*base->event_sigcb)(); + /* You cannot use this interface for multi-threaded apps */ + while (event_gotsig) { + event_gotsig = 0; + if (event_sigcb) { + res = (*event_sigcb)(); if (res == -1) { errno = EINTR; return (-1); @@ -600,7 +605,7 @@ event_del(struct event *ev) /* An event without a base has not been added */ if (ev->ev_base == NULL) - return; + return (-1); base = ev->ev_base; evsel = base->evsel;