diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c
index da6cd42..36b1c51 100644
--- a/third_party/libevent/event.c
+++ b/third_party/libevent/event.c
@@ -107,11 +107,7 @@ static const struct eventop *eventops[] = {
/* Global state */
struct event_base *current_base = NULL;
extern struct event_base *evsignal_base;
-static int use_monotonic;
-
-/* Handle signals - This is a deprecated interface */
-int (*event_sigcb)(void); /* Signal callback when gotsig is set */
-volatile sig_atomic_t event_gotsig; /* Set in signal handler */
+static int use_monotonic = 1;
/* Prototypes */
static void event_queue_insert(struct event_base *, struct event *, int);
@@ -124,17 +120,6 @@ static int timeout_next(struct event_base *, struct timeval **);
static void timeout_process(struct event_base *);
static void timeout_correct(struct event_base *, struct timeval *);
-static void
-detect_monotonic(void)
-{
-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
- struct timespec ts;
-
- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
- use_monotonic = 1;
-#endif
-}
-
static int
gettime(struct event_base *base, struct timeval *tp)
{
@@ -144,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp)
}
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
- if (use_monotonic) {
- struct timespec ts;
-
- if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
- return (-1);
+ struct timespec ts;
+ if (use_monotonic &&
+ clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
tp->tv_sec = ts.tv_sec;
tp->tv_usec = ts.tv_nsec / 1000;
return (0);
}
#endif
+ use_monotonic = 0;
+
return (evutil_gettimeofday(tp, NULL));
}
@@ -179,10 +164,6 @@ event_base_new(void)
if ((base = calloc(1, sizeof(struct event_base))) == NULL)
event_err(1, "%s: calloc", __func__);
- event_sigcb = NULL;
- event_gotsig = 0;
-
- detect_monotonic();
gettime(base, &base->event_tv);
min_heap_ctor(&base->timeheap);
@@ -398,12 +379,9 @@ event_process_active(struct event_base *base)
ncalls--;
ev->ev_ncalls = ncalls;
(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
- if (event_gotsig || base->event_break) {
- ev->ev_pncalls = NULL;
+ if (base->event_break)
return;
- }
}
- ev->ev_pncalls = NULL;
}
}
@@ -506,18 +484,6 @@ event_base_loop(struct event_base *base, int flags)
break;
}
- /* 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);
- }
- }
- }
-
timeout_correct(base, &tv);
tv_p = &tv;
@@ -808,8 +774,6 @@ int
event_del(struct event *ev)
{
struct event_base *base;
- const struct eventop *evsel;
- void *evbase;
event_debug(("event_del: %p, callback %p",
ev, ev->ev_callback));
@@ -819,8 +783,6 @@ event_del(struct event *ev)
return (-1);
base = ev->ev_base;
- evsel = base->evsel;
- evbase = base->evbase;
assert(!(ev->ev_flags & ~EVLIST_ALL));
@@ -838,7 +800,7 @@ event_del(struct event *ev)
if (ev->ev_flags & EVLIST_INSERTED) {
event_queue_remove(base, ev, EVLIST_INSERTED);
- return (evsel->del(evbase, ev));
+ return (base->evsel->del(base->evbase, ev));
}
return (0);
diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h
index d1f5d9e..f0887b9 100644
--- a/third_party/libevent/event.h
+++ b/third_party/libevent/event.h
@@ -159,7 +159,7 @@
extern "C" {
#endif
-#include <event-config.h>
+#include "event-config.h"
#ifdef _EVENT_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -172,7 +172,7 @@ extern "C" {
#include <stdarg.h>
/* For int types. */
-#include <evutil.h>
+#include "evutil.h"
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
diff --git a/third_party/libevent/evutil.h b/third_party/libevent/evutil.h
index dcb0013..8b664b9 100644
--- a/third_party/libevent/evutil.h
+++ b/third_party/libevent/evutil.h
@@ -38,7 +38,7 @@
extern "C" {
#endif
-#include <event-config.h>
+#include "event-config.h"
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif