commit cf8117136c1b206e727d582a4c378ce53e058414 Merge: 8592126 0f6c021 Author: Nick Mathewson nickm@torproject.org Date: Mon Nov 14 17:59:42 2011 -0500
Merge remote-tracking branch 'public/bug4457_022' into bug4457_master
Conflicts: src/common/compat_libevent.c
Resolving conflict by not taking 7363eae13cb8 ("Use the EVENT_BASE_FLAG_NOLOCK flag to prevent socketpair() invocation"): in Tor 0.2.3.x, we _do_ sometimes use notifiable event bases.
changes/bug4457 | 9 +++++++++ src/common/compat_libevent.c | 6 ++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
diff --cc src/common/compat_libevent.c index 3201738,ddb2da6..c533461 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@@ -196,25 -179,12 +196,26 @@@ tor_libevent_initialize(tor_libevent_cf #ifdef HAVE_EVENT2_EVENT_H { struct event_config *cfg = event_config_new(); + tor_assert(cfg);
- /* 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); +#if defined(MS_WINDOWS) && defined(USE_BUFFEREVENTS) + if (! torcfg->disable_iocp) { + evthread_use_windows_threads(); + event_config_set_flag(cfg, EVENT_BASE_FLAG_STARTUP_IOCP); + using_iocp_bufferevents = 1; + } +#endif + +#if defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER >= V(2,0,7) + if (torcfg->num_cpus > 0) + event_config_set_num_cpus_hint(cfg, torcfg->num_cpus); +#endif + +#if LIBEVENT_VERSION_NUMBER >= V(2,0,9) + /* We can enable changelist support with epoll, since we don't give + * Libevent any dup'd fds. This lets us avoid some syscalls. */ + event_config_set_flag(cfg, EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST); +#endif
the_event_base = event_base_new_with_config(cfg);