Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4d3b1896
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4d3b1896
编写于
3月 30, 2022
作者:
wafwerar
提交者:
GitHub
3月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11113 from taosdata/fix/ZhiqiangWang/TD-13759-add-pthread-func
[TD-13759]<fix>: add pthread func.
上级
9427300b
be4cd29d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
467 addition
and
141 deletion
+467
-141
include/os/osThread.h
include/os/osThread.h
+183
-68
include/os/osTime.h
include/os/osTime.h
+2
-0
source/os/src/osSocket.c
source/os/src/osSocket.c
+2
-2
source/os/src/osThread.c
source/os/src/osThread.c
+273
-64
source/util/src/tprocess.c
source/util/src/tprocess.c
+3
-3
source/util/test/queueTest.cpp
source/util/test/queueTest.cpp
+4
-4
未找到文件。
include/os/osThread.h
浏览文件 @
4d3b1896
...
...
@@ -32,6 +32,9 @@ typedef pthread_once_t TdThreadOnce;
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
...
...
@@ -39,78 +42,190 @@ typedef pthread_condattr_t TdThreadCondAttr;
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
#define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
#define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
#define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
#define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
#define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
#define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
#define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
#define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
#define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
#define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
#define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
#define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
#define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
#define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
#define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
#define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
#define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
#define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
#define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
#define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
#define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
#define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
#define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
#define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
#define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
#define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
#define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
#define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
#define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
#define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
#define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
#define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
// #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
// #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
// #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
// #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
// #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
// #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
// #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
// #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
// #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
// #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
// #define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID
// #define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID
// #define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID
// #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
// #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
// #define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID
// #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID
// #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID
// #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID
// #define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID
// #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID
// #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
// #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
// #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID
// #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID
// #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID
// #define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID
// #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID
// #define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID
// #define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID
// #define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID
// #define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID
// #define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID
// #define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID
// #define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID
// #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
// #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
// #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
// #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
// #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
// #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
// #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID
// #define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID
// #define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID
// #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
// #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
// #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
// #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
// #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
// #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
// #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
// #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
// #define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID
// #define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID
// #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
// #define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID
// #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
// #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
// #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
// #define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID
// #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID
// #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
// #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID
// #define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID
// #define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID
// #define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID
// #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID
// #define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID
// #define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID
// #define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID
// #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
// #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
// #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
// #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
// #define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID
// #define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID
// #define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID
// #define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID
// #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
// #define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID
// #define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID
// #define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID
// #define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID
// #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
// #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
// #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
// #define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID
// #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
// #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
// #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
// #define sigwait SIGWAIT_FUNC_TAOS_FORBID
#endif
int32_t
taosThreadSpinInit
(
TdThreadSpinlock
*
lock
,
int
pshared
);
int32_t
taosThreadMutexInit
(
TdThreadMutex
*
mutex
,
const
TdThreadMutexAttr
*
attr
);
int32_t
taosThreadSpinDestroy
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadCreate
(
TdThread
*
tid
,
const
TdThreadAttr
*
attr
,
void
*
(
*
start
)(
void
*
),
void
*
arg
);
int32_t
taosThreadAttrDestroy
(
TdThreadAttr
*
attr
);
int32_t
taosThreadAttrGetDetachState
(
const
TdThreadAttr
*
attr
,
int32_t
*
detachstate
);
int32_t
taosThreadAttrGetInheritSched
(
const
TdThreadAttr
*
attr
,
int32_t
*
inheritsched
);
int32_t
taosThreadAttrGetSchedParam
(
const
TdThreadAttr
*
attr
,
struct
sched_param
*
param
);
int32_t
taosThreadAttrGetSchedPolicy
(
const
TdThreadAttr
*
attr
,
int32_t
*
policy
);
int32_t
taosThreadAttrGetScope
(
const
TdThreadAttr
*
attr
,
int32_t
*
contentionscope
);
int32_t
taosThreadAttrGetStackSize
(
const
TdThreadAttr
*
attr
,
size_t
*
stacksize
);
int32_t
taosThreadAttrInit
(
TdThreadAttr
*
attr
);
int32_t
taosThreadAttrSetDetachState
(
TdThreadAttr
*
attr
,
int32_t
detachstate
);
int32_t
taosThreadAttrSetInheritSched
(
TdThreadAttr
*
attr
,
int32_t
inheritsched
);
int32_t
taosThreadAttrSetSchedParam
(
TdThreadAttr
*
attr
,
const
struct
sched_param
*
param
);
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
);
int32_t
taosThreadCondSignal
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondBroadcast
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
);
int32_t
taosThreadCondTimedWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
,
const
struct
timespec
*
abstime
);
int32_t
taosThreadCondAttrDestroy
(
TdThreadCondAttr
*
attr
);
int32_t
taosThreadCondAttrGetPshared
(
const
TdThreadCondAttr
*
attr
,
int32_t
*
pshared
);
int32_t
taosThreadCondAttrInit
(
TdThreadCondAttr
*
attr
);
int32_t
taosThreadCondAttrSetPshared
(
TdThreadCondAttr
*
attr
,
int32_t
pshared
);
int32_t
taosThreadDetach
(
TdThread
thread
);
int32_t
taosThreadEqual
(
TdThread
t1
,
TdThread
t2
);
void
taosThreadExit
(
void
*
valuePtr
);
int32_t
taosThreadGetSchedParam
(
TdThread
thread
,
int32_t
*
policy
,
struct
sched_param
*
param
);
void
*
taosThreadGetSpecific
(
TdThreadKey
key
);
int32_t
taosThreadJoin
(
TdThread
thread
,
void
**
valuePtr
);
int32_t
taosThreadKeyCreate
(
TdThreadKey
*
key
,
void
(
*
destructor
)(
void
*
));
int32_t
taosThreadKeyDelete
(
TdThreadKey
key
);
int32_t
taosThreadKill
(
TdThread
thread
,
int32_t
sig
);
int32_t
taosThreadMutexConsistent
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadMutexDestroy
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadSpinLock
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadMutexLock
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadRwlockRdlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadSpinUnlock
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadMutexUnlock
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadRwlockWrlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockUnlock
(
TdThreadRwlock
*
rwlock
);
void
taosThreadTestCancel
(
void
);
int32_t
taosThreadAttrInit
(
TdThreadAttr
*
attr
);
int32_t
taosThreadCreate
(
TdThread
*
tid
,
const
TdThreadAttr
*
attr
,
void
*
(
*
start
)(
void
*
),
void
*
arg
);
int32_t
taosThreadOnce
(
TdThreadOnce
*
onceControl
,
void
(
*
initRoutine
)(
void
));
int32_t
taosThreadAttrSetDetachState
(
TdThreadAttr
*
attr
,
int32_t
detachState
);
int32_t
taosThreadAttrDestroy
(
TdThreadAttr
*
attr
);
int32_t
taosThreadJoin
(
TdThread
thread
,
void
**
pValue
);
int32_t
taosThreadRwlockInit
(
TdThreadRwlock
*
rwlock
,
const
TdThreadRwlockAttr
*
attr
);
int32_t
taosThreadRwlockDestroy
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadCondSignal
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondInit
(
TdThreadCond
*
cond
,
const
TdThreadCondAttr
*
attr
);
int32_t
taosThreadCondBroadcast
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondDestroy
(
TdThreadCond
*
cond
);
int32_t
taosThreadCondWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
);
int32_t
taosThreadMutexInit
(
TdThreadMutex
*
mutex
,
const
TdThreadMutexAttr
*
attr
);
int32_t
taosThreadMutexLock
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadMutexTimedLock
(
TdThreadMutex
*
mutex
,
const
struct
timespec
*
abstime
);
int32_t
taosThreadMutexTryLock
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadMutexUnlock
(
TdThreadMutex
*
mutex
);
int32_t
taosThreadMutexAttrDestroy
(
TdThreadMutexAttr
*
attr
);
int32_t
taosThreadMutexAttrGetPshared
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
pshared
);
int32_t
taosThreadMutexAttrGetRobust
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
robust
);
int32_t
taosThreadMutexAttrGetType
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
kind
);
int32_t
taosThreadMutexAttrInit
(
TdThreadMutexAttr
*
attr
);
int32_t
taosThreadMutexAttrSetPshared
(
TdThreadMutexAttr
*
attr
,
int32_t
pshared
);
int32_t
taosThreadMutexAttrSetRobust
(
TdThreadMutexAttr
*
attr
,
int32_t
robust
);
int32_t
taosThreadMutexAttrSetType
(
TdThreadMutexAttr
*
attr
,
int32_t
kind
);
int32_t
taosThreadOnce
(
TdThreadOnce
*
onceControl
,
void
(
*
initRoutine
)(
void
));
int32_t
taosThreadRwlockDestroy
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockInit
(
TdThreadRwlock
*
rwlock
,
const
TdThreadRwlockAttr
*
attr
);
int32_t
taosThreadRwlockRdlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockTimedRdlock
(
TdThreadRwlock
*
rwlock
,
const
struct
timespec
*
abstime
);
int32_t
taosThreadRwlockTimedWrlock
(
TdThreadRwlock
*
rwlock
,
const
struct
timespec
*
abstime
);
int32_t
taosThreadRwlockTryRdlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockTryWrlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockUnlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockWrlock
(
TdThreadRwlock
*
rwlock
);
int32_t
taosThreadRwlockAttrDestroy
(
TdThreadRwlockAttr
*
attr
);
int32_t
taosThreadRwlockAttrGetPshared
(
const
TdThreadRwlockAttr
*
attr
,
int32_t
*
pshared
);
int32_t
taosThreadRwlockAttrInit
(
TdThreadRwlockAttr
*
attr
);
int32_t
taosThreadRwlockAttrSetPshared
(
TdThreadRwlockAttr
*
attr
,
int32_t
pshared
);
TdThread
taosThreadSelf
(
void
);
int32_t
taosThreadEqual
(
TdThread
t1
,
TdThread
t2
);
int32_t
taosThreadSigmask
(
int
how
,
sigset_t
const
*
set
,
sigset_t
*
oset
);
int32_t
taosThreadCancel
(
TdThread
thread
);
int32_t
taosThreadKill
(
TdThread
thread
,
int
sig
);
int32_t
taosThreadSetCancelState
(
int32_t
state
,
int32_t
*
oldstate
);
int32_t
taosThreadSetCancelType
(
int32_t
type
,
int32_t
*
oldtype
);
int32_t
taosThreadSetSchedParam
(
TdThread
thread
,
int32_t
policy
,
const
struct
sched_param
*
param
);
int32_t
taosThreadSetSpecific
(
TdThreadKey
key
,
const
void
*
value
);
int32_t
taosThreadSpinDestroy
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadSpinInit
(
TdThreadSpinlock
*
lock
,
int32_t
pshared
);
int32_t
taosThreadSpinLock
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadSpinTrylock
(
TdThreadSpinlock
*
lock
);
int32_t
taosThreadSpinUnlock
(
TdThreadSpinlock
*
lock
);
void
taosThreadTestCancel
(
void
);
int32_t
taosThreadSigMask
(
int32_t
how
,
sigset_t
const
*
set
,
sigset_t
*
oset
);
int32_t
taosThreadSigWait
(
const
sigset_t
*
set
,
int32_t
*
sig
);
#ifdef __cplusplus
}
#endif
...
...
include/os/osTime.h
浏览文件 @
4d3b1896
...
...
@@ -20,6 +20,8 @@
extern
"C"
{
#endif
#include <time.h>
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
...
...
source/os/src/osSocket.c
浏览文件 @
4d3b1896
...
...
@@ -758,7 +758,7 @@ void taosBlockSIGPIPE() {
sigset_t
signal_mask
;
sigemptyset
(
&
signal_mask
);
sigaddset
(
&
signal_mask
,
SIGPIPE
);
int32_t
rc
=
taosThreadSig
m
ask
(
SIG_BLOCK
,
&
signal_mask
,
NULL
);
int32_t
rc
=
taosThreadSig
M
ask
(
SIG_BLOCK
,
&
signal_mask
,
NULL
);
if
(
rc
!=
0
)
{
// printf("failed to block SIGPIPE");
}
...
...
@@ -876,7 +876,7 @@ void taosSetMaskSIGPIPE() {
sigset_t
signal_mask
;
sigemptyset
(
&
signal_mask
);
sigaddset
(
&
signal_mask
,
SIGPIPE
);
int32_t
rc
=
taosThreadSig
m
ask
(
SIG_SETMASK
,
&
signal_mask
,
NULL
);
int32_t
rc
=
taosThreadSig
M
ask
(
SIG_SETMASK
,
&
signal_mask
,
NULL
);
if
(
rc
!=
0
)
{
// printf("failed to setmask SIGPIPE");
}
...
...
source/os/src/osThread.c
浏览文件 @
4d3b1896
...
...
@@ -14,132 +14,341 @@
*/
#define ALLOW_FORBID_FUNC
#include <pthread.h>
#include "os.h"
// int32_t taosThreadSetnameNp(TdThread thread, const char *name) {
// return pthread_setname_np(thread,name);
// }
int32_t
taosThreadCreate
(
TdThread
*
tid
,
const
TdThreadAttr
*
attr
,
void
*
(
*
start
)(
void
*
),
void
*
arg
)
{
return
pthread_create
(
tid
,
attr
,
start
,
arg
);
}
int32_t
taosThreadAttrDestroy
(
TdThreadAttr
*
attr
)
{
return
pthread_attr_destroy
(
attr
);
}
int32_t
taosThreadAttrGetDetachState
(
const
TdThreadAttr
*
attr
,
int32_t
*
detachstate
)
{
return
pthread_attr_getdetachstate
(
attr
,
detachstate
);
}
int32_t
taosThreadAttrGetInheritSched
(
const
TdThreadAttr
*
attr
,
int32_t
*
inheritsched
)
{
return
pthread_attr_getinheritsched
(
attr
,
inheritsched
);
}
int32_t
taosThreadAttrGetSchedParam
(
const
TdThreadAttr
*
attr
,
struct
sched_param
*
param
)
{
return
pthread_attr_getschedparam
(
attr
,
param
);
}
int32_t
taosThreadAttrGetSchedPolicy
(
const
TdThreadAttr
*
attr
,
int32_t
*
policy
)
{
return
pthread_attr_getschedpolicy
(
attr
,
policy
);
}
int32_t
taosThreadAttrGetScope
(
const
TdThreadAttr
*
attr
,
int32_t
*
contentionscope
)
{
return
pthread_attr_getscope
(
attr
,
contentionscope
);
}
int32_t
taosThreadAttrGetStackSize
(
const
TdThreadAttr
*
attr
,
size_t
*
stacksize
)
{
return
pthread_attr_getstacksize
(
attr
,
stacksize
);
}
int32_t
taosThreadAttrInit
(
TdThreadAttr
*
attr
)
{
return
pthread_attr_init
(
attr
);
}
int32_t
taosThreadAttrSetDetachState
(
TdThreadAttr
*
attr
,
int32_t
detachstate
)
{
return
pthread_attr_setdetachstate
(
attr
,
detachstate
);
}
int32_t
taosThreadAttrSetInheritSched
(
TdThreadAttr
*
attr
,
int32_t
inheritsched
)
{
return
pthread_attr_setinheritsched
(
attr
,
inheritsched
);
}
int32_t
taosThreadAttrSetSchedParam
(
TdThreadAttr
*
attr
,
const
struct
sched_param
*
param
)
{
return
pthread_attr_setschedparam
(
attr
,
param
);
}
int32_t
taosThreadAttrSetSchedPolicy
(
TdThreadAttr
*
attr
,
int32_t
policy
)
{
return
pthread_attr_setschedpolicy
(
attr
,
policy
);
}
int32_t
taosThreadAttrSetScope
(
TdThreadAttr
*
attr
,
int32_t
contentionscope
)
{
return
pthread_attr_setscope
(
attr
,
contentionscope
);
}
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
);
}
int32_t
taosThreadCondDestroy
(
TdThreadCond
*
cond
)
{
return
pthread_cond_destroy
(
cond
);
}
int32_t
taosThreadCondInit
(
TdThreadCond
*
cond
,
const
TdThreadCondAttr
*
attr
)
{
return
pthread_cond_init
(
cond
,
attr
);
}
int32_t
taosThreadCondSignal
(
TdThreadCond
*
cond
)
{
return
pthread_cond_signal
(
cond
);
}
int32_t
taosThreadCondBroadcast
(
TdThreadCond
*
cond
)
{
return
pthread_cond_broadcast
(
cond
);
}
int32_t
taosThreadCondWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
)
{
return
pthread_cond_wait
(
cond
,
mutex
);
}
int32_t
taosThread
SpinInit
(
TdThreadSpinlock
*
lock
,
int
pshared
)
{
return
pthread_spin_init
(
lock
,
pshared
);
int32_t
taosThread
CondTimedWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
,
const
struct
timespec
*
abstime
)
{
return
pthread_cond_timedwait
(
cond
,
mutex
,
abstime
);
}
int32_t
taosThread
MutexInit
(
TdThreadMutex
*
mutex
,
const
TdThreadMutexAttr
*
attr
)
{
return
pthread_mutex_init
(
mutex
,
attr
);
int32_t
taosThread
CondAttrDestroy
(
TdThreadCondAttr
*
attr
)
{
return
pthread_condattr_destroy
(
attr
);
}
int32_t
taosThreadSpinDestroy
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_destroy
(
lock
);
int32_t
taosThreadCondAttrGetPshared
(
const
TdThreadCondAttr
*
attr
,
int32_t
*
pshared
)
{
return
pthread_condattr_getpshared
(
attr
,
pshared
);
}
int32_t
taosThreadCondAttrInit
(
TdThreadCondAttr
*
attr
)
{
return
pthread_condattr_init
(
attr
);
}
int32_t
taosThreadCondAttrSetPshared
(
TdThreadCondAttr
*
attr
,
int32_t
pshared
)
{
return
pthread_condattr_setpshared
(
attr
,
pshared
);
}
int32_t
taosThreadDetach
(
TdThread
thread
)
{
return
pthread_detach
(
thread
);
}
int32_t
taosThreadEqual
(
TdThread
t1
,
TdThread
t2
)
{
return
pthread_equal
(
t1
,
t2
);
}
void
taosThreadExit
(
void
*
valuePtr
)
{
return
pthread_exit
(
valuePtr
);
}
int32_t
taosThreadGetSchedParam
(
TdThread
thread
,
int32_t
*
policy
,
struct
sched_param
*
param
)
{
return
pthread_getschedparam
(
thread
,
policy
,
param
);
}
void
*
taosThreadGetSpecific
(
TdThreadKey
key
)
{
return
pthread_getspecific
(
key
);
}
int32_t
taosThreadJoin
(
TdThread
thread
,
void
**
valuePtr
)
{
return
pthread_join
(
thread
,
valuePtr
);
}
int32_t
taosThreadKeyCreate
(
TdThreadKey
*
key
,
void
(
*
destructor
)(
void
*
))
{
return
pthread_key_create
(
key
,
destructor
);
}
int32_t
taosThreadKeyDelete
(
TdThreadKey
key
)
{
return
pthread_key_delete
(
key
);
}
int32_t
taosThreadKill
(
TdThread
thread
,
int32_t
sig
)
{
return
pthread_kill
(
thread
,
sig
);
}
int32_t
taosThreadMutexConsistent
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_consistent
(
mutex
);
}
int32_t
taosThreadMutexDestroy
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_destroy
(
mutex
);
return
pthread_mutex_destroy
(
mutex
);
}
int32_t
taosThread
SpinLock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_lock
(
lock
);
int32_t
taosThread
MutexInit
(
TdThreadMutex
*
mutex
,
const
TdThreadMutexAttr
*
attr
)
{
return
pthread_mutex_init
(
mutex
,
attr
);
}
int32_t
taosThreadMutexLock
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_lock
(
mutex
);
int32_t
taosThreadMutexLock
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_lock
(
mutex
);
}
int32_t
taosThread
SpinUnlock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_unlock
(
lock
);
int32_t
taosThread
MutexTimedLock
(
TdThreadMutex
*
mutex
,
const
struct
timespec
*
abstime
)
{
return
pthread_mutex_timedlock
(
mutex
,
abstime
);
}
int32_t
taosThreadMutex
Unlock
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_un
lock
(
mutex
);
int32_t
taosThreadMutex
TryLock
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_try
lock
(
mutex
);
}
int32_t
taosThread
RwlockRdlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_rdlock
(
rwlock
);
int32_t
taosThread
MutexUnlock
(
TdThreadMutex
*
mutex
)
{
return
pthread_mutex_unlock
(
mutex
);
}
int32_t
taosThread
RwlockWrlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_wrlock
(
rwlock
);
int32_t
taosThread
MutexAttrDestroy
(
TdThreadMutexAttr
*
attr
)
{
return
pthread_mutexattr_destroy
(
attr
);
}
int32_t
taosThread
RwlockUnlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_unlock
(
rwlock
);
int32_t
taosThread
MutexAttrGetPshared
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
pshared
)
{
return
pthread_mutexattr_getpshared
(
attr
,
pshared
);
}
void
taosThreadTestCancel
(
void
)
{
return
pthread_testcancel
();
int32_t
taosThreadMutexAttrGetRobust
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
robust
)
{
return
pthread_mutexattr_getrobust
(
attr
,
robust
);
}
int32_t
taosThreadMutexAttrGetType
(
const
TdThreadMutexAttr
*
attr
,
int32_t
*
kind
)
{
return
pthread_mutexattr_gettype
(
attr
,
kind
);
}
int32_t
taosThread
AttrInit
(
TdThreadAttr
*
attr
)
{
return
pthread_
attr_init
(
attr
);
int32_t
taosThread
MutexAttrInit
(
TdThreadMutexAttr
*
attr
)
{
return
pthread_mutex
attr_init
(
attr
);
}
int32_t
taosThread
Create
(
TdThread
*
tid
,
const
TdThreadAttr
*
attr
,
void
*
(
*
start
)(
void
*
),
void
*
arg
)
{
return
pthread_create
(
tid
,
attr
,
start
,
arg
);
int32_t
taosThread
MutexAttrSetPshared
(
TdThreadMutexAttr
*
attr
,
int32_t
pshared
)
{
return
pthread_mutexattr_setpshared
(
attr
,
pshared
);
}
int32_t
taosThread
Once
(
TdThreadOnce
*
onceControl
,
void
(
*
initRoutine
)(
void
)
)
{
return
pthread_once
(
onceControl
,
initRoutine
);
int32_t
taosThread
MutexAttrSetRobust
(
TdThreadMutexAttr
*
attr
,
int32_t
robust
)
{
return
pthread_mutexattr_setrobust
(
attr
,
robust
);
}
int32_t
taosThread
AttrSetDetachState
(
TdThreadAttr
*
attr
,
int32_t
detachState
)
{
return
pthread_attr_setdetachstate
(
attr
,
detachState
);
int32_t
taosThread
MutexAttrSetType
(
TdThreadMutexAttr
*
attr
,
int32_t
kind
)
{
return
pthread_mutexattr_settype
(
attr
,
kind
);
}
int32_t
taosThread
AttrDestroy
(
TdThreadAttr
*
attr
)
{
return
pthread_attr_destroy
(
attr
);
int32_t
taosThread
Once
(
TdThreadOnce
*
onceControl
,
void
(
*
initRoutine
)(
void
)
)
{
return
pthread_once
(
onceControl
,
initRoutine
);
}
int32_t
taosThread
Join
(
TdThread
thread
,
void
**
pValue
)
{
return
pthread_join
(
thread
,
pValue
);
int32_t
taosThread
RwlockDestroy
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_destroy
(
rwlock
);
}
int32_t
taosThreadRwlockInit
(
TdThreadRwlock
*
rwlock
,
const
TdThreadRwlockAttr
*
attr
)
{
return
pthread_rwlock_init
(
rwlock
,
attr
);
int32_t
taosThreadRwlockInit
(
TdThreadRwlock
*
rwlock
,
const
TdThreadRwlockAttr
*
attr
)
{
return
pthread_rwlock_init
(
rwlock
,
attr
);
}
int32_t
taosThreadRwlock
Destroy
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_destroy
(
rwlock
);
int32_t
taosThreadRwlock
Rdlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_rdlock
(
rwlock
);
}
int32_t
taosThread
CondSignal
(
TdThreadCond
*
cond
)
{
return
pthread_cond_signal
(
cond
);
int32_t
taosThread
RwlockTimedRdlock
(
TdThreadRwlock
*
rwlock
,
const
struct
timespec
*
abstime
)
{
return
pthread_rwlock_timedrdlock
(
rwlock
,
abstime
);
}
int32_t
taosThread
CondInit
(
TdThreadCond
*
cond
,
const
TdThreadCondAttr
*
attr
)
{
return
pthread_cond_init
(
cond
,
attr
);
int32_t
taosThread
RwlockTimedWrlock
(
TdThreadRwlock
*
rwlock
,
const
struct
timespec
*
abstime
)
{
return
pthread_rwlock_timedwrlock
(
rwlock
,
abstime
);
}
int32_t
taosThread
CondBroadcast
(
TdThreadCond
*
cond
)
{
return
pthread_cond_broadcast
(
cond
);
int32_t
taosThread
RwlockTryRdlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_tryrdlock
(
rwlock
);
}
int32_t
taosThread
CondDestroy
(
TdThreadCond
*
cond
)
{
return
pthread_cond_destroy
(
cond
);
int32_t
taosThread
RwlockTryWrlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_trywrlock
(
rwlock
);
}
int32_t
taosThreadCondWait
(
TdThreadCond
*
cond
,
TdThreadMutex
*
mutex
)
{
return
pthread_cond_wait
(
cond
,
mutex
);
int32_t
taosThreadRwlockUnlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_unlock
(
rwlock
);
}
int32_t
taosThreadRwlockWrlock
(
TdThreadRwlock
*
rwlock
)
{
return
pthread_rwlock_wrlock
(
rwlock
);
}
int32_t
taosThreadRwlockAttrDestroy
(
TdThreadRwlockAttr
*
attr
)
{
return
pthread_rwlockattr_destroy
(
attr
);
}
int32_t
taosThreadRwlockAttrGetPshared
(
const
TdThreadRwlockAttr
*
attr
,
int32_t
*
pshared
)
{
return
pthread_rwlockattr_getpshared
(
attr
,
pshared
);
}
int32_t
taosThreadRwlockAttrInit
(
TdThreadRwlockAttr
*
attr
)
{
return
pthread_rwlockattr_init
(
attr
);
}
int32_t
taosThreadRwlockAttrSetPshared
(
TdThreadRwlockAttr
*
attr
,
int32_t
pshared
)
{
return
pthread_rwlockattr_setpshared
(
attr
,
pshared
);
}
TdThread
taosThreadSelf
(
void
)
{
return
pthread_self
();
return
pthread_self
();
}
// int32_t taosThreadGetW32ThreadIdNp(TdThread thread
) {
// return pthread_getw32threadid_np(thread
);
//
}
int32_t
taosThreadSetCancelState
(
int32_t
state
,
int32_t
*
oldstate
)
{
return
pthread_setcancelstate
(
state
,
oldstate
);
}
int32_t
taosThread
Equal
(
TdThread
t1
,
TdThread
t2
)
{
return
pthread_equal
(
t1
,
t2
);
int32_t
taosThread
SetCancelType
(
int32_t
type
,
int32_t
*
oldtype
)
{
return
pthread_setcanceltype
(
type
,
oldtype
);
}
int32_t
taosThreadS
igmask
(
int
how
,
sigset_t
const
*
set
,
sigset_t
*
oset
)
{
return
pthread_sigmask
(
how
,
set
,
oset
);
int32_t
taosThreadS
etSchedParam
(
TdThread
thread
,
int32_t
policy
,
const
struct
sched_param
*
param
)
{
return
pthread_setschedparam
(
thread
,
policy
,
param
);
}
int32_t
taosThreadCancel
(
TdThread
thread
)
{
return
pthread_cancel
(
thread
);
int32_t
taosThreadSetSpecific
(
TdThreadKey
key
,
const
void
*
value
)
{
return
pthread_setspecific
(
key
,
value
);
}
int32_t
taosThreadSpinDestroy
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_destroy
(
lock
);
}
int32_t
taosThreadSpinInit
(
TdThreadSpinlock
*
lock
,
int32_t
pshared
)
{
return
pthread_spin_init
(
lock
,
pshared
);
}
int32_t
taosThreadSpinLock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_lock
(
lock
);
}
int32_t
taosThreadSpinTrylock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_trylock
(
lock
);
}
int32_t
taosThreadSpinUnlock
(
TdThreadSpinlock
*
lock
)
{
return
pthread_spin_unlock
(
lock
);
}
void
taosThreadTestCancel
(
void
)
{
return
pthread_testcancel
();
}
int32_t
taosThreadSigMask
(
int32_t
how
,
sigset_t
const
*
set
,
sigset_t
*
oset
)
{
return
pthread_sigmask
(
how
,
set
,
oset
);
}
int32_t
taosThread
Kill
(
TdThread
thread
,
int
sig
)
{
return
pthread_kill
(
thread
,
sig
);
int32_t
taosThread
SigWait
(
const
sigset_t
*
set
,
int32_t
*
sig
)
{
return
sigwait
(
set
,
sig
);
}
\ No newline at end of file
source/util/src/tprocess.c
浏览文件 @
4d3b1896
...
...
@@ -64,13 +64,13 @@ static int32_t taosProcInitMutex(TdThreadMutex **ppMutex, int32_t *pShmid) {
int32_t
shmid
=
-
1
;
int32_t
code
=
-
1
;
if
(
pthread_mutexattr_i
nit
(
&
mattr
)
!=
0
)
{
if
(
taosThreadMutexAttrI
nit
(
&
mattr
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to init mutex while init attr since %s"
,
terrstr
());
goto
_OVER
;
}
if
(
pthread_mutexattr_setp
shared
(
&
mattr
,
PTHREAD_PROCESS_SHARED
)
!=
0
)
{
if
(
taosThreadMutexAttrSetP
shared
(
&
mattr
,
PTHREAD_PROCESS_SHARED
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to init mutex while set shared since %s"
,
terrstr
());
goto
_OVER
;
...
...
@@ -112,7 +112,7 @@ _OVER:
*
pShmid
=
shmid
;
}
pthread_mutexattr_d
estroy
(
&
mattr
);
taosThreadMutexAttrD
estroy
(
&
mattr
);
return
code
;
}
...
...
source/util/test/queueTest.cpp
浏览文件 @
4d3b1896
...
...
@@ -36,12 +36,12 @@ TEST_F(UtilTestQueue, 01_fork) {
int err;
pthread_mutexattr_t mattr;
if ((err =
pthread_mutexattr_i
nit(&mattr)) < 0) {
if ((err =
taosThreadMutexAttrI
nit(&mattr)) < 0) {
printf("mutex addr init error:%s\n", strerror(err));
exit(1);
}
if ((err =
pthread_mutexattr_setp
shared(&mattr, PTHREAD_PROCESS_SHARED)) < 0) {
if ((err =
taosThreadMutexAttrSetP
shared(&mattr, PTHREAD_PROCESS_SHARED)) < 0) {
printf("mutex addr get shared error:%s\n", strerror(err));
exit(1);
}
...
...
@@ -50,7 +50,7 @@ TEST_F(UtilTestQueue, 01_fork) {
int mid = shmget(IPC_PRIVATE, sizeof(pthread_mutex_t), 0600);
m = (pthread_mutex_t*)shmat(mid, NULL, 0);
if ((err =
pthread_mutex_i
nit(m, &mattr)) < 0) {
if ((err =
taosThreadMutexI
nit(m, &mattr)) < 0) {
printf("mutex mutex init error:%s\n", strerror(err));
exit(1);
}
...
...
@@ -125,7 +125,7 @@ TEST_F(UtilTestQueue, 01_fork) {
taosThreadAttrDestroy(&mattr);
//销毁mutex
pthread_mutex_d
estroy(m);
taosThreadMutexD
estroy(m);
exit(0);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录