Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33e384a7
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
33e384a7
编写于
12月 10, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10564] refactor and add test cases.
上级
cfc63289
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
104 addition
and
0 deletion
+104
-0
source/client/src/clientmain.c
source/client/src/clientmain.c
+86
-0
source/client/test/CMakeLists.txt
source/client/test/CMakeLists.txt
+18
-0
未找到文件。
source/client/src/clientmain.c
0 → 100644
浏览文件 @
33e384a7
#include "clientInt.h"
#include "trpc.h"
#include "os.h"
#include "taosmsg.h"
#include "tcache.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tnote.h"
#include "tref.h"
#include "tscLog.h"
#include "tsched.h"
#include "ttime.h"
#include "ttimezone.h"
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0
static
int32_t
sentinel
=
TSC_VAR_NOT_RELEASE
;
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
extern
int32_t
tscInitRes
;
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...)
{
static
int32_t
lock
=
0
;
for
(
int
i
=
1
;
atomic_val_compare_exchange_32
(
&
lock
,
0
,
1
)
!=
0
;
++
i
)
{
if
(
i
%
1000
==
0
)
{
tscInfo
(
"haven't acquire lock after spin %d times."
,
i
);
sched_yield
();
}
}
int
ret
=
taos_options_imp
(
option
,
(
const
char
*
)
arg
);
atomic_store_32
(
&
lock
,
0
);
return
ret
;
}
int
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
return
tscInitRes
;
}
// this function may be called by user or system, or by both simultaneously.
void
taos_cleanup
(
void
)
{
tscDebug
(
"start to cleanup client environment"
);
if
(
atomic_val_compare_exchange_32
(
&
sentinel
,
TSC_VAR_NOT_RELEASE
,
TSC_VAR_RELEASED
)
!=
TSC_VAR_NOT_RELEASE
)
{
return
;
}
int32_t
id
=
tscReqRef
;
tscReqRef
=
-
1
;
taosCloseRef
(
id
);
void
*
p
=
tscQhandle
;
tscQhandle
=
NULL
;
taosCleanUpScheduler
(
p
);
id
=
tscConnRef
;
tscConnRef
=
-
1
;
taosCloseRef
(
id
);
p
=
tscRpcCache
;
tscRpcCache
=
NULL
;
if
(
p
!=
NULL
)
{
taosCacheCleanup
(
p
);
pthread_mutex_destroy
(
&
rpcObjMutex
);
}
rpcCleanup
();
taosCloseLog
();
}
void
taos_close
(
TAOS
*
taos
)
{
}
const
char
*
taos_errstr
(
TAOS_RES
*
res
)
{
}
void
taos_free_result
(
TAOS_RES
*
res
)
{
}
\ No newline at end of file
source/client/test/CMakeLists.txt
0 → 100644
浏览文件 @
33e384a7
MESSAGE
(
STATUS
"build parser unit test"
)
# GoogleTest requires at least C++11
SET
(
CMAKE_CXX_STANDARD 11
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
clientTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
clientTest
PUBLIC os util common transport gtest taos
)
TARGET_INCLUDE_DIRECTORIES
(
clientTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/client/"
PRIVATE
"
${
CMAKE_SOURCE_DIR
}
/source/libs/client/inc"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录