1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
From 914a9e09b56696311b9fce8acfa9380c74eb8e23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 21 May 2015 12:53:38 +0300
Subject: [PATCH] fix joining to threads
do not detach threads that we later join to. joining to detached
thread invokes unspecified behaviour (usually crash).
---
src/switch_log.c | 2 --
src/switch_scheduler.c | 1 -
2 files changed, 3 deletions(-)
diff --git a/src/switch_log.c b/src/switch_log.c
index 00ae7c0..c512b2d 100644
--- a/src/switch_log.c
+++ b/src/switch_log.c
@@ -512,8 +512,6 @@ SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, swit
LOG_POOL = pool;
switch_threadattr_create(&thd_attr, LOG_POOL);
- switch_threadattr_detach_set(thd_attr, 1);
-
switch_queue_create(&LOG_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
#ifdef SWITCH_LOG_RECYCLE
diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c
index e734bad..16fc59d 100644
--- a/src/switch_scheduler.c
+++ b/src/switch_scheduler.c
@@ -335,7 +335,6 @@ SWITCH_DECLARE(void) switch_scheduler_task_thread_start(void)
switch_mutex_init(&globals.task_mutex, SWITCH_MUTEX_NESTED, globals.memory_pool);
switch_queue_create(&globals.event_queue, 250000, globals.memory_pool);
- switch_threadattr_detach_set(thd_attr, 1);
switch_thread_create(&task_thread_p, thd_attr, switch_scheduler_task_thread, NULL, globals.memory_pool);
}
--
2.4.1
|