Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7ec8fb43
提交
7ec8fb43
authored
6月 29, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add initial-event-threads to switch.conf.xml
上级
dca6e2bb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
7 行删除
+28
-7
switch_event.h
src/include/switch_event.h
+1
-0
switch_core.c
src/switch_core.c
+18
-1
switch_event.c
src/switch_event.c
+9
-6
没有找到文件。
src/include/switch_event.h
浏览文件 @
7ec8fb43
...
@@ -403,6 +403,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event);
...
@@ -403,6 +403,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event);
SWITCH_DECLARE
(
char
*
)
switch_event_build_param_string
(
switch_event_t
*
event
,
const
char
*
prefix
,
switch_hash_t
*
vars_map
);
SWITCH_DECLARE
(
char
*
)
switch_event_build_param_string
(
switch_event_t
*
event
,
const
char
*
prefix
,
switch_hash_t
*
vars_map
);
SWITCH_DECLARE
(
int
)
switch_event_check_permission_list
(
switch_event_t
*
list
,
const
char
*
name
);
SWITCH_DECLARE
(
int
)
switch_event_check_permission_list
(
switch_event_t
*
list
,
const
char
*
name
);
SWITCH_DECLARE
(
void
)
switch_event_add_presence_data_cols
(
switch_channel_t
*
channel
,
switch_event_t
*
event
,
const
char
*
prefix
);
SWITCH_DECLARE
(
void
)
switch_event_add_presence_data_cols
(
switch_channel_t
*
channel
,
switch_event_t
*
event
,
const
char
*
prefix
);
SWITCH_DECLARE
(
void
)
switch_event_launch_dispatch_threads
(
uint32_t
max
);
///\}
///\}
...
...
src/switch_core.c
浏览文件 @
7ec8fb43
...
@@ -1538,7 +1538,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
...
@@ -1538,7 +1538,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_log_init
(
runtime
.
memory_pool
,
runtime
.
colorize_console
);
switch_log_init
(
runtime
.
memory_pool
,
runtime
.
colorize_console
);
if
(
flags
&
SCF_MINIMAL
)
return
SWITCH_STATUS_SUCCESS
;
if
(
flags
&
SCF_MINIMAL
)
return
SWITCH_STATUS_SUCCESS
;
runtime
.
tipping_point
=
0
;
runtime
.
tipping_point
=
0
;
runtime
.
timer_affinity
=
-
1
;
runtime
.
timer_affinity
=
-
1
;
runtime
.
microseconds_per_tick
=
20000
;
runtime
.
microseconds_per_tick
=
20000
;
...
@@ -1813,6 +1813,23 @@ static void switch_load_core_config(const char *file)
...
@@ -1813,6 +1813,23 @@ static void switch_load_core_config(const char *file)
switch_core_min_idle_cpu
(
atof
(
val
));
switch_core_min_idle_cpu
(
atof
(
val
));
}
else
if
(
!
strcasecmp
(
var
,
"tipping-point"
)
&&
!
zstr
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"tipping-point"
)
&&
!
zstr
(
val
))
{
runtime
.
tipping_point
=
atoi
(
val
);
runtime
.
tipping_point
=
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"initial-event-threads"
)
&&
!
zstr
(
val
))
{
int
tmp
=
atoi
(
val
);
if
(
tmp
>
runtime
.
cpu_count
/
2
)
{
tmp
=
runtime
.
cpu_count
/
2
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"This value cannot be higher than %d so setting it to that value
\n
"
,
runtime
.
cpu_count
/
2
);
}
if
(
tmp
<
1
)
{
tmp
=
1
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"This value cannot be lower than 1 so setting it to that level
\n
"
);
}
switch_event_launch_dispatch_threads
(
tmp
);
}
else
if
(
!
strcasecmp
(
var
,
"1ms-timer"
)
&&
switch_true
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"1ms-timer"
)
&&
switch_true
(
val
))
{
runtime
.
microseconds_per_tick
=
1000
;
runtime
.
microseconds_per_tick
=
1000
;
}
else
if
(
!
strcasecmp
(
var
,
"timer-affinity"
)
&&
!
zstr
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"timer-affinity"
)
&&
!
zstr
(
val
))
{
...
...
src/switch_event.c
浏览文件 @
7ec8fb43
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <switch.h>
#include <switch.h>
#include <switch_event.h>
#include <switch_event.h>
//#define SWITCH_EVENT_RECYCLE
//#define SWITCH_EVENT_RECYCLE
#define DISPATCH_QUEUE_LEN 100
#define DISPATCH_QUEUE_LEN 100
//#define DEBUG_DISPATCH_QUEUES
//#define DEBUG_DISPATCH_QUEUES
...
@@ -87,7 +88,6 @@ static uint64_t EVENT_SEQUENCE_NR = 0;
...
@@ -87,7 +88,6 @@ static uint64_t EVENT_SEQUENCE_NR = 0;
static
switch_queue_t
*
EVENT_RECYCLE_QUEUE
=
NULL
;
static
switch_queue_t
*
EVENT_RECYCLE_QUEUE
=
NULL
;
static
switch_queue_t
*
EVENT_HEADER_RECYCLE_QUEUE
=
NULL
;
static
switch_queue_t
*
EVENT_HEADER_RECYCLE_QUEUE
=
NULL
;
#endif
#endif
static
void
launch_dispatch_threads
(
uint32_t
max
,
switch_memory_pool_t
*
pool
);
static
char
*
my_dup
(
const
char
*
s
)
static
char
*
my_dup
(
const
char
*
s
)
{
{
...
@@ -305,7 +305,7 @@ static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp
...
@@ -305,7 +305,7 @@ static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp
if
(
launch
)
{
if
(
launch
)
{
if
(
SOFT_MAX_DISPATCH
+
1
<
MAX_DISPATCH
)
{
if
(
SOFT_MAX_DISPATCH
+
1
<
MAX_DISPATCH
)
{
launch_dispatch_threads
(
SOFT_MAX_DISPATCH
+
1
,
RUNTIME_POOL
);
switch_event_launch_dispatch_threads
(
SOFT_MAX_DISPATCH
+
1
);
}
}
}
}
...
@@ -515,13 +515,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
...
@@ -515,13 +515,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
static
void
launch_dispatch_threads
(
uint32_t
max
,
switch_memory_pool_t
*
pool
)
SWITCH_DECLARE
(
void
)
switch_event_launch_dispatch_threads
(
uint32_t
max
)
{
{
switch_threadattr_t
*
thd_attr
;
switch_threadattr_t
*
thd_attr
;
uint32_t
index
=
0
;
uint32_t
index
=
0
;
int
launched
=
0
;
int
launched
=
0
;
uint32_t
sanity
=
200
;
uint32_t
sanity
=
200
;
switch_memory_pool_t
*
pool
=
RUNTIME_POOL
;
if
(
max
>
MAX_DISPATCH
)
{
if
(
max
>
MAX_DISPATCH
)
{
return
;
return
;
}
}
...
@@ -532,6 +534,7 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
...
@@ -532,6 +534,7 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
for
(
index
=
SOFT_MAX_DISPATCH
;
index
<
max
&&
index
<
MAX_DISPATCH
;
index
++
)
{
for
(
index
=
SOFT_MAX_DISPATCH
;
index
<
max
&&
index
<
MAX_DISPATCH
;
index
++
)
{
if
(
EVENT_DISPATCH_QUEUE_THREADS
[
index
])
{
if
(
EVENT_DISPATCH_QUEUE_THREADS
[
index
])
{
printf
(
"Index exists continue
\n
"
);
continue
;
continue
;
}
}
...
@@ -540,13 +543,13 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
...
@@ -540,13 +543,13 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
switch_threadattr_priority_increase
(
thd_attr
);
switch_threadattr_priority_increase
(
thd_attr
);
switch_thread_create
(
&
EVENT_DISPATCH_QUEUE_THREADS
[
index
],
thd_attr
,
switch_event_dispatch_thread
,
EVENT_DISPATCH_QUEUE
,
pool
);
switch_thread_create
(
&
EVENT_DISPATCH_QUEUE_THREADS
[
index
],
thd_attr
,
switch_event_dispatch_thread
,
EVENT_DISPATCH_QUEUE
,
pool
);
while
(
--
sanity
&&
!
EVENT_DISPATCH_QUEUE_RUNNING
[
index
])
switch_yield
(
10000
);
while
(
--
sanity
&&
!
EVENT_DISPATCH_QUEUE_RUNNING
[
index
])
switch_yield
(
10000
);
if
(
index
==
1
)
{
if
(
index
==
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBU
G
,
"Create event dispatch thread %d
\n
"
,
index
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNIN
G
,
"Create event dispatch thread %d
\n
"
,
index
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Create additional event dispatch thread %d
\n
"
,
index
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Create additional event dispatch thread %d
\n
"
,
index
);
}
}
launched
++
;
launched
++
;
break
;
}
}
SOFT_MAX_DISPATCH
=
index
;
SOFT_MAX_DISPATCH
=
index
;
...
@@ -598,7 +601,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
...
@@ -598,7 +601,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
//switch_threadattr_priority_increase(thd_attr);
//switch_threadattr_priority_increase(thd_attr);
switch_queue_create
(
&
EVENT_DISPATCH_QUEUE
,
DISPATCH_QUEUE_LEN
*
MAX_DISPATCH
,
pool
);
switch_queue_create
(
&
EVENT_DISPATCH_QUEUE
,
DISPATCH_QUEUE_LEN
*
MAX_DISPATCH
,
pool
);
launch_dispatch_threads
(
1
,
RUNTIME_POOL
);
switch_event_launch_dispatch_threads
(
1
);
//switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论