Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c7b14b7
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9c7b14b7
编写于
1月 05, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2652
上级
95b8d347
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
8 deletion
+24
-8
src/os/src/detail/osTimer.c
src/os/src/detail/osTimer.c
+5
-0
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+3
-0
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+16
-8
未找到文件。
src/os/src/detail/osTimer.c
浏览文件 @
9c7b14b7
...
@@ -89,12 +89,17 @@ int taosInitTimer(void (*callback)(int), int ms) {
...
@@ -89,12 +89,17 @@ int taosInitTimer(void (*callback)(int), int ms) {
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
uError
(
"failed to create timer thread"
);
uError
(
"failed to create timer thread"
);
return
-
1
;
return
-
1
;
}
else
{
uDebug
(
"timer thread:0x%08"
PRIx64
" is created"
,
taosGetPthreadId
(
timerThread
));
}
}
return
0
;
return
0
;
}
}
void
taosUninitTimer
()
{
void
taosUninitTimer
()
{
stopTimer
=
true
;
stopTimer
=
true
;
uDebug
(
"join timer thread:0x%08"
PRIx64
,
taosGetPthreadId
(
timerThread
));
pthread_join
(
timerThread
,
NULL
);
pthread_join
(
timerThread
,
NULL
);
}
}
...
...
tests/tsim/src/simExe.c
浏览文件 @
9c7b14b7
...
@@ -292,6 +292,9 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
...
@@ -292,6 +292,9 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
if
(
pthread_create
(
&
newScript
->
bgPid
,
NULL
,
simExecuteScript
,
(
void
*
)
newScript
)
!=
0
)
{
if
(
pthread_create
(
&
newScript
->
bgPid
,
NULL
,
simExecuteScript
,
(
void
*
)
newScript
)
!=
0
)
{
sprintf
(
script
->
error
,
"lineNum:%d. create background thread failed"
,
script
->
lines
[
script
->
linePos
].
lineNum
);
sprintf
(
script
->
error
,
"lineNum:%d. create background thread failed"
,
script
->
lines
[
script
->
linePos
].
lineNum
);
return
false
;
return
false
;
}
else
{
simDebug
(
"script:%s, background thread:0x%08"
PRIx64
" is created"
,
newScript
->
fileName
,
taosGetPthreadId
(
newScript
->
bgPid
));
}
}
script
->
linePos
++
;
script
->
linePos
++
;
...
...
tests/tsim/src/simSystem.c
浏览文件 @
9c7b14b7
...
@@ -93,23 +93,30 @@ void simFreeScript(SScript *script) {
...
@@ -93,23 +93,30 @@ void simFreeScript(SScript *script) {
for
(
int32_t
i
=
0
;
i
<
script
->
bgScriptLen
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
script
->
bgScriptLen
;
++
i
)
{
SScript
*
bgScript
=
script
->
bgScripts
[
i
];
SScript
*
bgScript
=
script
->
bgScripts
[
i
];
sim
Info
(
"script:%s, set stop flag"
,
s
cript
->
fileName
);
sim
Debug
(
"script:%s, is background script, set stop flag"
,
bgS
cript
->
fileName
);
bgScript
->
killed
=
true
;
bgScript
->
killed
=
true
;
if
(
taosCheckPthreadValid
(
bgScript
->
bgPid
))
{
if
(
taosCheckPthreadValid
(
bgScript
->
bgPid
))
{
pthread_join
(
bgScript
->
bgPid
,
NULL
);
pthread_join
(
bgScript
->
bgPid
,
NULL
);
}
}
simDebug
(
"script:%s, background thread joined"
,
bgScript
->
fileName
);
taos_close
(
bgScript
->
taos
);
tfree
(
bgScript
->
lines
);
tfree
(
bgScript
->
optionBuffer
);
tfree
(
bgScript
);
}
}
}
simDebug
(
"script:%s, is freed"
,
script
->
fileName
);
simDebug
(
"script:%s, is cleaned"
,
script
->
fileName
);
taos_close
(
script
->
taos
);
taos_close
(
script
->
taos
);
tfree
(
script
->
lines
);
tfree
(
script
->
lines
);
tfree
(
script
->
optionBuffer
);
tfree
(
script
->
optionBuffer
);
tfree
(
script
);
tfree
(
script
);
}
}
}
SScript
*
simProcessCallOver
(
SScript
*
script
)
{
SScript
*
simProcessCallOver
(
SScript
*
script
)
{
if
(
script
->
type
==
SIM_SCRIPT_TYPE_MAIN
)
{
if
(
script
->
type
==
SIM_SCRIPT_TYPE_MAIN
)
{
simDebug
(
"script:%s, is main script, set stop flag"
,
script
->
fileName
);
if
(
script
->
killed
)
{
if
(
script
->
killed
)
{
simInfo
(
"script:"
FAILED_PREFIX
"%s"
FAILED_POSTFIX
", "
FAILED_PREFIX
"failed"
FAILED_POSTFIX
", error:%s"
,
simInfo
(
"script:"
FAILED_PREFIX
"%s"
FAILED_POSTFIX
", "
FAILED_PREFIX
"failed"
FAILED_POSTFIX
", error:%s"
,
script
->
fileName
,
script
->
error
);
script
->
fileName
,
script
->
error
);
...
@@ -131,7 +138,7 @@ SScript *simProcessCallOver(SScript *script) {
...
@@ -131,7 +138,7 @@ SScript *simProcessCallOver(SScript *script) {
return
simScriptList
[
simScriptPos
];
return
simScriptList
[
simScriptPos
];
}
}
}
else
{
}
else
{
sim
Info
(
"script:%s, is stopped by main script
"
,
script
->
fileName
);
sim
Debug
(
"script:%s, is stopped
"
,
script
->
fileName
);
simFreeScript
(
script
);
simFreeScript
(
script
);
return
NULL
;
return
NULL
;
}
}
...
@@ -161,5 +168,6 @@ void *simExecuteScript(void *inputScript) {
...
@@ -161,5 +168,6 @@ void *simExecuteScript(void *inputScript) {
}
}
}
}
simInfo
(
"thread is stopped"
);
return
NULL
;
return
NULL
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录