mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
don't init threads as side effect of assertion
Fixes part of bug 15211.
This commit is contained in:
parent
b683b9af00
commit
68e9f364a0
5
changes/bug15211
Normal file
5
changes/bug15211
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Remove side-effects from tor_assert() calls. This was harmless,
|
||||||
|
because we never disable assertions, but it is bad style and
|
||||||
|
unnecessary. Fixes bug 15211; bugfix on 0.2.5.5.
|
||||||
|
|
@ -276,14 +276,16 @@ void
|
|||||||
tor_threads_init(void)
|
tor_threads_init(void)
|
||||||
{
|
{
|
||||||
if (!threads_initialized) {
|
if (!threads_initialized) {
|
||||||
|
int ret;
|
||||||
pthread_mutexattr_init(&attr_recursive);
|
pthread_mutexattr_init(&attr_recursive);
|
||||||
pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_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
|
#ifndef PTHREAD_CREATE_DETACHED
|
||||||
#define PTHREAD_CREATE_DETACHED 1
|
#define PTHREAD_CREATE_DETACHED 1
|
||||||
#endif
|
#endif
|
||||||
tor_assert(0==pthread_attr_setdetachstate(&attr_detached,
|
ret = pthread_attr_setdetachstate(&attr_detached, PTHREAD_CREATE_DETACHED);
|
||||||
PTHREAD_CREATE_DETACHED));
|
tor_assert(ret == 0);
|
||||||
threads_initialized = 1;
|
threads_initialized = 1;
|
||||||
set_main_thread();
|
set_main_thread();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user