aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat_libevent.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-14 17:46:43 -0500
committerNick Mathewson <nickm@torproject.org>2011-11-14 17:48:57 -0500
commit7363eae13cb8febd85923957de19e2de7c186cea (patch)
treebcf5661be95e2718e1619654d0beb72dfd4a3c58 /src/common/compat_libevent.c
parent2b7bdc295a516df457246fb69f83c8667695c59b (diff)
downloadtor-7363eae13cb8febd85923957de19e2de7c186cea.tar
tor-7363eae13cb8febd85923957de19e2de7c186cea.tar.gz
Use the EVENT_BASE_FLAG_NOLOCK flag to prevent socketpair() invocation
In Tor 0.2.2, we never need the event base to be notifiable, since we don't call it from other threads. This is a workaround for bug 4457, which is not actually a Tor bug IMO.
Diffstat (limited to 'src/common/compat_libevent.c')
-rw-r--r--src/common/compat_libevent.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 6d89be804..3e35e093e 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -177,7 +177,18 @@ tor_libevent_initialize(void)
#endif
#ifdef HAVE_EVENT2_EVENT_H
- the_event_base = event_base_new();
+ {
+ struct event_config *cfg = event_config_new();
+
+ /* In 0.2.2, we don't use locking at all. Telling Libevent not to try to
+ * turn it on can avoid a needless socketpair() attempt.
+ */
+ event_config_set_flag(cfg, EVENT_BASE_FLAG_NOLOCK);
+
+ the_event_base = event_base_new_with_config(cfg);
+
+ event_config_free(cfg);
+ }
#else
the_event_base = event_init();
#endif