]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
When initializing pthreads, always set the main thread.
authorNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 14:37:12 +0000 (09:37 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 14:37:12 +0000 (09:37 -0500)
Fixes bug 32884.  This is a bugfix on 0.3.3.1-alpha, when we started
allowing restart-in-process with tor_api.h.

changes/bug32884 [new file with mode: 0644]
src/lib/thread/compat_pthreads.c

diff --git a/changes/bug32884 b/changes/bug32884
new file mode 100644 (file)
index 0000000..9ab1d24
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (embedded Tor):
+    - When starting Tor any time after the first time in a process, register
+      the thread in which it is running as the main thread.  Previously, we
+      only did this on Windows, which could lead to bugs like 23081 on
+      non-Windows platforms.  Fixes bug 32884; bugfix on 0.3.3.1-alpha.
index 05efe9cfd04de8676862d38d122aa2df93815c3b..6f7ecd17da6b1e121fb325d4d1b29bdb1f468ad7 100644 (file)
@@ -265,6 +265,6 @@ tor_threads_init(void)
       pthread_attr_setdetachstate(&attr_detached, PTHREAD_CREATE_DETACHED);
     tor_assert(ret2 == 0);
     threads_initialized = 1;
-    set_main_thread();
   }
+  set_main_thread();
 }