summaryrefslogtreecommitdiff
path: root/src/common/compat_pthreads.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/compat_pthreads.c')
-rw-r--r--src/common/compat_pthreads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index f4a6cad154..246076b276 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -279,7 +279,11 @@ tor_threads_init(void)
pthread_mutexattr_init(&attr_recursive);
pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE);
tor_assert(0==pthread_attr_init(&attr_detached));
- tor_assert(0==pthread_attr_setdetachstate(&attr_detached, 1));
+#ifndef PTHREAD_CREATE_DETACHED
+#define PTHREAD_CREATE_DETACHED 1
+#endif
+ tor_assert(0==pthread_attr_setdetachstate(&attr_detached,
+ PTHREAD_CREATE_DETACHED));
threads_initialized = 1;
set_main_thread();
}