[tor-commits] [tor/master] Call evthread_use_windows_threads when running with IOCP on windows

nickm at torproject.org nickm at torproject.org
Wed Aug 17 18:43:53 UTC 2011


commit 52e36feda153e70cd08d624df73035b7e59a95ef
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Aug 17 14:44:16 2011 -0400

    Call evthread_use_windows_threads when running with IOCP on windows
---
 changes/le-win-threads       |    3 +++
 src/common/compat_libevent.c |    5 ++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/changes/le-win-threads b/changes/le-win-threads
new file mode 100644
index 0000000..5be44a2
--- /dev/null
+++ b/changes/le-win-threads
@@ -0,0 +1,3 @@
+  o Major bugfixes (IOCP):
+    - When using IOCP on windows, we need to enable Libevent windows threading
+      support. Bugfix on 0.2.3.1-alpha.
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index c338dd6..8752de7 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_EVENT2_EVENT_H
 #include <event2/event.h>
+#include <event2/thread.h>
 #else
 #include <event.h>
 #endif
@@ -183,8 +184,10 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
     struct event_config *cfg = event_config_new();
 
 #if defined(MS_WINDOWS) && defined(USE_BUFFEREVENTS)
-    if (! torcfg->disable_iocp)
+    if (! torcfg->disable_iocp) {
+      evthread_use_windows_threads();
       event_config_set_flag(cfg, EVENT_BASE_FLAG_STARTUP_IOCP);
+    }
 #endif
 
 #if defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER >= V(2,0,7)



More information about the tor-commits mailing list