Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
68b69be5
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看板
提交
68b69be5
编写于
4月 18, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(os): centos pthread spinlock error.
上级
63b0e304
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
42 deletion
+29
-42
include/os/osThread.h
include/os/osThread.h
+4
-9
source/os/src/osThread.c
source/os/src/osThread.c
+25
-33
未找到文件。
include/os/osThread.h
浏览文件 @
68b69be5
...
...
@@ -22,6 +22,10 @@
extern
"C"
{
#endif
#ifndef __USE_XOPEN2K
typedef
pthread_mutex_t
pthread_spinlock_t
;
#endif
typedef
pthread_t
TdThread
;
typedef
pthread_spinlock_t
TdThreadSpinlock
;
typedef
pthread_mutex_t
TdThreadMutex
;
...
...
@@ -33,8 +37,6 @@ typedef pthread_rwlockattr_t TdThreadRwlockAttr;
typedef
pthread_cond_t
TdThreadCond
;
typedef
pthread_condattr_t
TdThreadCondAttr
;
typedef
pthread_key_t
TdThreadKey
;
typedef
pthread_barrier_t
TdThreadBarrier
;
typedef
pthread_barrierattr_t
TdThreadBarrierAttr
;
#define taosThreadCleanupPush pthread_cleanup_push
#define taosThreadCleanupPop pthread_cleanup_pop
...
...
@@ -156,13 +158,6 @@ int32_t taosThreadAttrSetSchedParam(TdThreadAttr * attr, const struct sched_para
int32_t
taosThreadAttrSetSchedPolicy
(
TdThreadAttr
*
attr
,
int32_t
policy
);
int32_t
taosThreadAttrSetScope
(
TdThreadAttr
*
attr
,
int32_t
contentionscope
);
int32_t
taosThreadAttrSetStackSize
(
TdThreadAttr
*
attr
,
size_t
stacksize
);
int32_t
taosThreadBarrierDestroy
(
TdThreadBarrier
*
barrier
);
int32_t
taosThreadBarrierInit
(
TdThreadBarrier
*
barrier
,
const
TdThreadBarrierAttr
*
attr
,
uint32_t
count
);
int32_t
taosThreadBarrierWait
(
TdThreadBarrier
*
barrier
);
int32_t
taosThreadBarrierAttrDestroy
(
TdThreadBarrierAttr
*
attr
);
int32_t
taosThreadBarrierAttrGetPshared
(
const
TdThreadBarrierAttr
*
attr
,
int32_t
*
pshared
);
int32_t
taosThreadBarrierAttrInit
(
TdThreadBarrierAttr
*
attr
);
int32_t
taosThreadBarrierAttrSetPshared
(
TdThreadBarrierAttr
*
attr
,
int32_t
pshared
);
int32_t
taosThreadCancel
(
TdThread
thread
);
int32_t
taosThreadCondDestroy
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondInit
(
TdThreadCond
*
cond
,
const
TdThreadCondAttr
*
attr
);
...
...
source/os/src/osThread.c
浏览文件 @
68b69be5
...
...
@@ -77,34 +77,6 @@ int32_t taosThreadAttrSetStackSize(TdThreadAttr * attr, size_t stacksize) {
return
pthread_attr_setstacksize
(
attr
,
stacksize
);
}
int32_t
taosThreadBarrierDestroy
(
TdThreadBarrier
*
barrier
)
{
return
pthread_barrier_destroy
(
barrier
);
}
int32_t
taosThreadBarrierInit
(
TdThreadBarrier
*
barrier
,
const
TdThreadBarrierAttr
*
attr
,
uint32_t
count
)
{
return
pthread_barrier_init
(
barrier
,
attr
,
count
);
}
int32_t
taosThreadBarrierWait
(
TdThreadBarrier
*
barrier
)
{
return
pthread_barrier_wait
(
barrier
);
}
int32_t
taosThreadBarrierAttrDestroy
(
TdThreadBarrierAttr
*
attr
)
{
return
pthread_barrierattr_destroy
(
attr
);
}
int32_t
taosThreadBarrierAttrGetPshared
(
const
TdThreadBarrierAttr
*
attr
,
int32_t
*
pshared
)
{
return
pthread_barrierattr_getpshared
(
attr
,
pshared
);
}
int32_t
taosThreadBarrierAttrInit
(
TdThreadBarrierAttr
*
attr
)
{
return
pthread_barrierattr_init
(
attr
);
}
int32_t
taosThreadBarrierAttrSetPshared
(
TdThreadBarrierAttr
*
attr
,
int32_t
pshared
)
{
return
pthread_barrierattr_setpshared
(
attr
,
pshared
);
}
int32_t
taosThreadCancel
(
TdThread
thread
)
{
return
pthread_cancel
(
thread
);
}
...
...
@@ -322,23 +294,43 @@ int32_t taosThreadSetSpecific(TdThreadKey key, const void *value) {
}
int32_t
taosThreadSpinDestroy
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_destroy
(
lock
);
#ifndef __USE_XOPEN2K
return
pthread_mutex_destroy
((
pthread_mutex_t
*
)
lock
);
#else
return
pthread_spin_destroy
((
pthread_spinlock_t
*
)
lock
);
#endif
}
int32_t
taosThreadSpinInit
(
TdThreadSpinlock
*
lock
,
int32_t
pshared
)
{
return
pthread_spin_init
(
lock
,
pshared
);
#ifndef __USE_XOPEN2K
return
pthread_mutex_init
((
pthread_mutex_t
*
)
lock
,
pshared
);
#else
return
pthread_spin_init
((
pthread_spinlock_t
*
)
lock
,
pshared
);
#endif
}
int32_t
taosThreadSpinLock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_lock
(
lock
);
#ifndef __USE_XOPEN2K
return
pthread_mutex_lock
((
pthread_mutex_t
*
)
lock
);
#else
return
pthread_spin_lock
((
pthread_spinlock_t
*
)
lock
);
#endif
}
int32_t
taosThreadSpinTrylock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_trylock
(
lock
);
#ifndef __USE_XOPEN2K
return
pthread_mutex_trylock
((
pthread_mutex_t
*
)
lock
);
#else
return
pthread_spin_trylock
((
pthread_spinlock_t
*
)
lock
);
#endif
}
int32_t
taosThreadSpinUnlock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_unlock
(
lock
);
#ifndef __USE_XOPEN2K
return
pthread_mutex_unlock
((
pthread_mutex_t
*
)
lock
);
#else
return
pthread_spin_unlock
((
pthread_spinlock_t
*
)
lock
);
#endif
}
void
taosThreadTestCancel
(
void
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录