aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-01-16 10:00:40 +1000
committerteor <teor@torproject.org>2020-01-16 10:00:40 +1000
commitfb541ffca31d4906642ffb3bbe6bb6079cfcb1c9 (patch)
treec6a3eb85e0d6b19e54524d89cb286782a14e9fc9 /src/lib
parentf5461a4bdf343a0572b0594fa33af37ce1be9d8f (diff)
parent026f068bb3aed9de0f1cc6792f6c9528b7b27db2 (diff)
downloadtor-fb541ffca31d4906642ffb3bbe6bb6079cfcb1c9.tar.gz
tor-fb541ffca31d4906642ffb3bbe6bb6079cfcb1c9.zip
Merge branch 'maint-0.4.0' into maint-0.4.1
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evloop/compat_libevent.c10
-rw-r--r--src/lib/evloop/compat_libevent.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/evloop/compat_libevent.c b/src/lib/evloop/compat_libevent.c
index 91eacb9938..939d77f857 100644
--- a/src/lib/evloop/compat_libevent.c
+++ b/src/lib/evloop/compat_libevent.c
@@ -181,6 +181,16 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
event_get_version(), tor_libevent_get_method());
}
+/**
+ * Return true iff the libevent module has been successfully initialized,
+ * and not subsequently shut down.
+ **/
+bool
+tor_libevent_is_initialized(void)
+{
+ return the_event_base != NULL;
+}
+
/** Return the current Libevent event base that we're set up to use. */
MOCK_IMPL(struct event_base *,
tor_libevent_get_base, (void))
diff --git a/src/lib/evloop/compat_libevent.h b/src/lib/evloop/compat_libevent.h
index afe887a013..92724c369c 100644
--- a/src/lib/evloop/compat_libevent.h
+++ b/src/lib/evloop/compat_libevent.h
@@ -13,6 +13,8 @@
#include "lib/testsupport/testsupport.h"
#include "lib/malloc/malloc.h"
+#include <stdbool.h>
+
void configure_libevent_logging(void);
void suppress_libevent_log_msg(const char *msg);
@@ -68,6 +70,7 @@ typedef struct tor_libevent_cfg {
} tor_libevent_cfg;
void tor_libevent_initialize(tor_libevent_cfg *cfg);
+bool tor_libevent_is_initialized(void);
MOCK_DECL(struct event_base *, tor_libevent_get_base, (void));
const char *tor_libevent_get_method(void);
void tor_check_libevent_header_compatibility(void);