aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2015-03-12 17:52:37 +0100
committerSebastian Hahn <sebastian@torproject.org>2015-03-12 17:52:37 +0100
commit68e9f364a01fa8efadd06745d2e54d699996646a (patch)
tree3512c3fce476aca33de6096e4d0a4702a2774ddf /src/common
parentb683b9af00b9ddf20f68169f47f8da0b49d6fbc8 (diff)
downloadtor-68e9f364a01fa8efadd06745d2e54d699996646a.tar.gz
tor-68e9f364a01fa8efadd06745d2e54d699996646a.zip
don't init threads as side effect of assertion
Fixes part of bug 15211.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat_pthreads.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index 246076b276..70259a8a53 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -276,14 +276,16 @@ void
tor_threads_init(void)
{
if (!threads_initialized) {
+ int ret;
pthread_mutexattr_init(&attr_recursive);
pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE);
- tor_assert(0==pthread_attr_init(&attr_detached));
+ ret = pthread_attr_init(&attr_detached);
+ tor_assert(ret == 0);
#ifndef PTHREAD_CREATE_DETACHED
#define PTHREAD_CREATE_DETACHED 1
#endif
- tor_assert(0==pthread_attr_setdetachstate(&attr_detached,
- PTHREAD_CREATE_DETACHED));
+ ret = pthread_attr_setdetachstate(&attr_detached, PTHREAD_CREATE_DETACHED);
+ tor_assert(ret == 0);
threads_initialized = 1;
set_main_thread();
}