Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a4f75510
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a4f75510
编写于
5月 08, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-4088
上级
ac3d6440
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
33 deletion
+28
-33
src/os/inc/osDarwin.h
src/os/inc/osDarwin.h
+1
-11
src/os/inc/osSemphone.h
src/os/inc/osSemphone.h
+9
-4
src/os/inc/osString.h
src/os/inc/osString.h
+1
-1
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+0
-1
src/os/src/darwin/darwinSemphone.c
src/os/src/darwin/darwinSemphone.c
+12
-12
src/os/src/detail/osSemphone.c
src/os/src/detail/osSemphone.c
+4
-4
src/os/src/windows/wGetline.c
src/os/src/windows/wGetline.c
+1
-0
未找到文件。
src/os/inc/osDarwin.h
浏览文件 @
a4f75510
...
...
@@ -74,17 +74,9 @@ extern "C" {
#define TAOS_OS_FUNC_FILE_SENDIFLE
#define TAOS_OS_FUNC_SEMPHONE
typedef
struct
tsem_s
*
tsem_t
;
int
tsem_init
(
tsem_t
*
sem
,
int
pshared
,
unsigned
int
value
);
int
tsem_wait
(
tsem_t
*
sem
);
int
tsem_post
(
tsem_t
*
sem
);
int
tsem_destroy
(
tsem_t
*
sem
);
#define TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
#define TAOS_OS_FUNC_SYSINFO
#define TAOS_OS_FUNC_TIMER
#define TAOS_OS_FUNC_SEMPHONE_PTHREAD
#define TAOS_OS_FUNC_TIMERD
// specific
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
...
...
@@ -104,8 +96,6 @@ typedef int(*__compar_fn_t)(const void *, const void *);
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#define TAOS_OS_FUNC_PTHREAD_RWLOCK
#include "eok.h"
void
taos_block_sigalrm
(
void
);
...
...
src/os/inc/osSemphone.h
浏览文件 @
a4f75510
...
...
@@ -20,15 +20,21 @@
extern
"C"
{
#endif
#ifndef TAOS_OS_FUNC_SEMPHONE
#if defined (_TD_DARWIN_64)
typedef
struct
tsem_s
*
tsem_t
;
int
tsem_init
(
tsem_t
*
sem
,
int
pshared
,
unsigned
int
value
);
int
tsem_wait
(
tsem_t
*
sem
);
int
tsem_post
(
tsem_t
*
sem
);
int
tsem_destroy
(
tsem_t
*
sem
);
#else
#define tsem_t sem_t
#define tsem_init sem_init
int
tsem_wait
(
tsem_t
*
sem
);
int
32_t
tsem_wait
(
tsem_t
*
sem
);
#define tsem_post sem_post
#define tsem_destroy sem_destroy
#endif
#if
def TAOS_OS_FUNC_PTHREAD_RWLOCK
#if
defined (_TD_DARWIN_64)
#define pthread_rwlock_t pthread_mutex_t
#define pthread_rwlock_init(lock, NULL) pthread_mutex_init(lock, NULL)
#define pthread_rwlock_destroy(lock) pthread_mutex_destroy(lock)
...
...
@@ -43,7 +49,6 @@ extern "C" {
#define pthread_spin_unlock(lock) pthread_mutex_unlock(lock)
#endif
// TAOS_OS_FUNC_SEMPHONE_PTHREAD
bool
taosCheckPthreadValid
(
pthread_t
thread
);
int64_t
taosGetSelfPthreadId
();
int64_t
taosGetPthreadId
(
pthread_t
thread
);
...
...
src/os/inc/osString.h
浏览文件 @
a4f75510
...
...
@@ -28,7 +28,7 @@ extern "C" {
#else
#define tstrdup(str) strdup(str)
#define tstrndup(str, size) strndup(str, size)
#define tgetline(lineptr, n, stream) getline(lineptr, n
, stream)
#define tgetline(lineptr, n, stream) getline(lineptr, n, stream)
#define twcslen wcslen
#endif
...
...
src/os/inc/osWindows.h
浏览文件 @
a4f75510
...
...
@@ -65,7 +65,6 @@ extern "C" {
#define TAOS_OS_FUNC_FILE_FTRUNCATE
#define TAOS_OS_FUNC_SEMPHONE_PTHREAD
#define TAOS_OS_FUNC_SOCKET
#define TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
...
...
src/os/src/darwin/darwinSemphone.c
浏览文件 @
a4f75510
...
...
@@ -37,7 +37,7 @@
static
pthread_t
sem_thread
;
static
pthread_once_t
sem_once
;
static
task_t
sem_port
;
static
volatile
int
sem_inited
=
0
;
static
volatile
int
32_t
sem_inited
=
0
;
static
semaphore_t
sem_exit
;
static
void
*
sem_thread_routine
(
void
*
arg
)
{
...
...
@@ -55,7 +55,7 @@ static void* sem_thread_routine(void *arg) {
}
static
void
once_init
(
void
)
{
int
r
=
0
;
int
32_t
r
=
0
;
r
=
pthread_create
(
&
sem_thread
,
NULL
,
sem_thread_routine
,
NULL
);
if
(
r
)
{
fprintf
(
stderr
,
"==%s[%d]%s()==failed to create thread
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
);
...
...
@@ -81,10 +81,10 @@ struct tsem_s {
dispatch_semaphore_t
sem
;
#endif // SEM_USE_PTHREAD
volatile
unsigned
int
valid
:
1
;
volatile
unsigned
int
32_t
valid
:
1
;
};
int
tsem_init
(
tsem_t
*
sem
,
int
pshared
,
unsigned
in
t
value
)
{
int
32_t
tsem_init
(
tsem_t
*
sem
,
int32_t
pshared
,
unsigned
int32_
t
value
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==creating\n", basename(__FILE__), __LINE__, __func__, sem);
if
(
*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==already initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
...
...
@@ -97,7 +97,7 @@ int tsem_init(tsem_t *sem, int pshared, unsigned int value) {
}
#ifdef SEM_USE_PTHREAD
int
r
=
pthread_mutex_init
(
&
p
->
lock
,
NULL
);
int
32_t
r
=
pthread_mutex_init
(
&
p
->
lock
,
NULL
);
do
{
if
(
r
)
break
;
r
=
pthread_cond_init
(
&
p
->
cond
,
NULL
);
...
...
@@ -124,7 +124,7 @@ int tsem_init(tsem_t *sem, int pshared, unsigned int value) {
p
->
sem
=
sem_open
(
name
,
O_CREAT
|
O_EXCL
,
pshared
,
value
);
p
->
id
=
id
;
if
(
p
->
sem
!=
SEM_FAILED
)
break
;
int
e
=
errno
;
int
32_t
e
=
errno
;
if
(
e
==
EEXIST
)
continue
;
if
(
e
==
EINTR
)
continue
;
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not created[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
...
...
@@ -158,7 +158,7 @@ int tsem_init(tsem_t *sem, int pshared, unsigned int value) {
return
0
;
}
int
tsem_wait
(
tsem_t
*
sem
)
{
int
32_t
tsem_wait
(
tsem_t
*
sem
)
{
if
(
!*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
abort
();
...
...
@@ -194,7 +194,7 @@ int tsem_wait(tsem_t *sem) {
#endif // SEM_USE_PTHREAD
}
int
tsem_post
(
tsem_t
*
sem
)
{
int
32_t
tsem_post
(
tsem_t
*
sem
)
{
if
(
!*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
abort
();
...
...
@@ -230,7 +230,7 @@ int tsem_post(tsem_t *sem) {
#endif // SEM_USE_PTHREAD
}
int
tsem_destroy
(
tsem_t
*
sem
)
{
int
32_t
tsem_destroy
(
tsem_t
*
sem
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==destroying\n", basename(__FILE__), __LINE__, __func__, sem);
if
(
!*
sem
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem);
...
...
@@ -264,9 +264,9 @@ int tsem_destroy(tsem_t *sem) {
#elif defined(SEM_USE_POSIX)
char
name
[
NAME_MAX
-
4
];
snprintf
(
name
,
sizeof
(
name
),
"/t%ld"
,
p
->
id
);
int
r
=
sem_unlink
(
name
);
int
32_t
r
=
sem_unlink
(
name
);
if
(
r
)
{
int
e
=
errno
;
int
32_t
e
=
errno
;
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==unlink failed[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
abort
();
}
...
...
@@ -284,7 +284,7 @@ int tsem_destroy(tsem_t *sem) {
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
uint64_t
id
=
0
;
int
r
=
pthread_threadid_np
(
thread
,
&
id
);
int
32_t
r
=
pthread_threadid_np
(
thread
,
&
id
);
return
r
?
false
:
true
;
}
...
...
src/os/src/detail/osSemphone.c
浏览文件 @
a4f75510
...
...
@@ -16,9 +16,9 @@
#define _DEFAULT_SOURCE
#include "os.h"
#if
ndef TAOS_OS_FUNC_SEMPHONE
#if
!defined (_TD_DARWIN_64)
int
tsem_wait
(
tsem_t
*
sem
)
{
int
32_t
tsem_wait
(
tsem_t
*
sem
)
{
int
ret
=
0
;
do
{
ret
=
sem_wait
(
sem
);
...
...
@@ -28,9 +28,9 @@ int tsem_wait(tsem_t* sem) {
#endif
#if
ndef TAOS_OS_FUNC_SEMPHONE_PTHREAD
#if
!(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) || defined (_TD_DARWIN_64))
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
return
thread
!=
0
;
}
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
return
thread
!=
0
;
}
int64_t
taosGetSelfPthreadId
()
{
static
__thread
int
id
=
0
;
...
...
src/os/src/windows/wGetline.c
浏览文件 @
a4f75510
...
...
@@ -22,6 +22,7 @@ General Public License for more details. */
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <stdint.h>
#if STDC_HEADERS
#include <stdlib.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录