]> granicus.if.org Git - libevent/commitdiff
provide maintainer mode in automake; put event_gotsig back into global
authorNiels Provos <provos@gmail.com>
Tue, 22 Feb 2005 15:47:53 +0000 (15:47 +0000)
committerNiels Provos <provos@gmail.com>
Tue, 22 Feb 2005 15:47:53 +0000 (15:47 +0000)
state; return proper error code

svn:r131

configure.in
event-internal.h
event.c

index f4a26b706b8c77e07431109a94afd8f7ce79bf62..52c2a3ef49e69944782641e84219f7c882d5154d 100644 (file)
@@ -2,7 +2,7 @@ dnl configure.in for libevent
 dnl Dug Song <dugsong@monkey.org>
 AC_INIT(event.c)
 
-AM_INIT_AUTOMAKE(libevent,1.0)
+AM_INIT_AUTOMAKE(libevent,1.0b)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
index 4f3659550fa254698c0f446735b1336d3a652a3d..becb6691d52acf42712d5587efa332300d6fcba9 100644 (file)
@@ -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 45d91a4a8130bcc082b13700dfec72b24a7ba2b5..2df71c886025bb80ee489846eea1a6809074c2b5 100644 (file)
--- 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(&current_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;