Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6f2466eb
提交
6f2466eb
authored
4月 22, 2019
作者:
Chris Rienzo
提交者:
Andrey Volk
7月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11801 [core] Update scheduler to allow destruction of running task
上级
8aa07b67
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
switch_scheduler.c
src/switch_scheduler.c
+15
-5
没有找到文件。
src/switch_scheduler.c
浏览文件 @
6f2466eb
...
...
@@ -38,6 +38,7 @@ struct switch_scheduler_task_container {
int
in_thread
;
int
destroyed
;
int
running
;
int
destroy_requested
;
switch_scheduler_func_t
func
;
switch_memory_pool_t
*
pool
;
uint32_t
flags
;
...
...
@@ -62,11 +63,12 @@ static void switch_scheduler_execute(switch_scheduler_task_container_t *tp)
tp
->
func
(
&
tp
->
task
);
switch_mutex_lock
(
globals
.
task_mutex
);
if
(
tp
->
task
.
repeat
)
{
tp
->
task
.
runtime
=
switch_epoch_time_now
(
NULL
)
+
tp
->
task
.
repeat
;
}
if
(
tp
->
task
.
runtime
>
tp
->
executed
)
{
if
(
!
tp
->
destroy_requested
&&
tp
->
task
.
runtime
>
tp
->
executed
)
{
tp
->
executed
=
0
;
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_RE_SCHEDULE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Task-ID"
,
"%u"
,
tp
->
task
.
task_id
);
...
...
@@ -79,6 +81,7 @@ static void switch_scheduler_execute(switch_scheduler_task_container_t *tp)
}
else
{
tp
->
destroyed
=
1
;
}
switch_mutex_unlock
(
globals
.
task_mutex
);
}
static
void
*
SWITCH_THREAD_FUNC
task_own_thread
(
switch_thread_t
*
thread
,
void
*
obj
)
...
...
@@ -275,12 +278,13 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_id(uint32_t task_id)
}
if
(
tp
->
running
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNING
,
"Attempt made to delete running task #%u (group %s)
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
INFO
,
"Attempt made to delete running task #%u (group %s)
\n
"
,
tp
->
task
.
task_id
,
tp
->
task
.
group
);
break
;
tp
->
destroy_requested
++
;
}
else
{
tp
->
destroyed
++
;
}
tp
->
destroyed
++
;
delcnt
++
;
break
;
}
...
...
@@ -314,7 +318,13 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_group(const char *group)
tp
->
task
.
task_id
,
group
);
continue
;
}
tp
->
destroyed
++
;
if
(
tp
->
running
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Attempt made to delete running task #%u (group %s)
\n
"
,
tp
->
task
.
task_id
,
tp
->
task
.
group
);
tp
->
destroy_requested
++
;
}
else
{
tp
->
destroyed
++
;
}
delcnt
++
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论