Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94eb0e1e
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看板
提交
94eb0e1e
编写于
1月 23, 2021
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. __APPLE__
2. tsem_xxx for mac
上级
6485afb6
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
43 addition
and
38 deletion
+43
-38
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+1
-1
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+1
-1
src/mnode/src/mnodeCluster.c
src/mnode/src/mnodeCluster.c
+1
-0
src/os/inc/osDarwin.h
src/os/inc/osDarwin.h
+5
-5
src/os/inc/osDef.h
src/os/inc/osDef.h
+3
-2
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+1
-1
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+8
-5
src/sync/src/syncTcp.c
src/sync/src/syncTcp.c
+4
-4
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+2
-2
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+2
-2
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+6
-6
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+4
-4
src/util/src/tsocket.c
src/util/src/tsocket.c
+1
-1
tests/examples/c/epoll.c
tests/examples/c/epoll.c
+2
-2
未找到文件。
src/client/src/tscUtil.c
浏览文件 @
94eb0e1e
...
...
@@ -2520,9 +2520,9 @@ bool tscSetSqlOwner(SSqlObj* pSql) {
// set the sql object owner
#ifdef __APPLE__
pthread_t
threadId
=
(
pthread_t
)
taosGetSelfPthreadId
();
#else
#else
// __APPLE__
uint64_t
threadId
=
taosGetSelfPthreadId
();
#endif
#endif
// __APPLE__
if
(
atomic_val_compare_exchange_64
(
&
pSql
->
owner
,
0
,
threadId
)
!=
0
)
{
pRes
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
return
false
;
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
94eb0e1e
...
...
@@ -164,7 +164,7 @@ static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context) {
dInfo
(
"shut down signal is %d, sender PID:%d"
,
signum
,
sigInfo
->
si_pid
);
#else // __APPLE__
dInfo
(
"shut down signal is %d, sender PID:%d cmdline:%s"
,
signum
,
sigInfo
->
si_pid
,
taosGetCmdlineByPID
(
sigInfo
->
si_pid
));
#endif
#endif
// __APPLE__
// protect the application from receive another signal
struct
sigaction
act
=
{{
0
}};
...
...
src/dnode/src/dnodeTelemetry.c
浏览文件 @
94eb0e1e
...
...
@@ -241,7 +241,7 @@ static int sem_timedwait(tsem_t *sem, struct timespec *to) {
fprintf
(
stderr
,
"%s[%d]%s(): not implemented yet!
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
);
abort
();
}
#endif
#endif
// __APPLE__
static
void
*
telemetryThread
(
void
*
param
)
{
struct
timespec
end
=
{
0
};
...
...
src/mnode/src/mnodeCluster.c
浏览文件 @
94eb0e1e
...
...
@@ -145,6 +145,7 @@ bool taosGetSystemUid(char *uid) {
return
false
;
}
#endif // __APPLE__
static
int32_t
mnodeCreateCluster
()
{
int32_t
numOfClusters
=
sdbGetNumOfRows
(
tsClusterSdb
);
if
(
numOfClusters
!=
0
)
return
TSDB_CODE_SUCCESS
;
...
...
src/os/inc/osDarwin.h
浏览文件 @
94eb0e1e
...
...
@@ -75,11 +75,11 @@ extern "C" {
#define TAOS_OS_FUNC_FILE_SENDIFLE
#define TAOS_OS_FUNC_SEMPHONE
#define tsem_t dispatch_semaphore_t
int
tsem_init
(
dispatch_semaphore
_t
*
sem
,
int
pshared
,
unsigned
int
value
);
int
tsem_wait
(
dispatch_semaphore
_t
*
sem
);
int
tsem_post
(
dispatch_semaphore
_t
*
sem
);
int
tsem_destroy
(
dispatch_semaphore
_t
*
sem
);
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_STRING_STR2INT64
...
...
src/os/inc/osDef.h
浏览文件 @
94eb0e1e
...
...
@@ -90,11 +90,12 @@ extern "C" {
#ifdef _ISOC11_SOURCE
#define threadlocal _Thread_local
#elif defined(__APPLE__)
#define threadlocal
#define threadlocal
__thread
#elif defined(__GNUC__) && !defined(threadlocal)
#define threadlocal __thread
#else
#define threadlocal
// #define threadlocal
#error please follow with the target platform's thread-local implementation
#endif
#ifdef __cplusplus
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
94eb0e1e
...
...
@@ -33,7 +33,7 @@ static bool httpReadData(HttpContext *pContext);
#ifdef __APPLE__
static
int
sv_dummy
=
0
;
#endif
#endif
// __APPLE__
static
void
httpStopThread
(
HttpThread
*
pThread
)
{
pThread
->
stop
=
true
;
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
94eb0e1e
...
...
@@ -312,9 +312,9 @@ void *taosInitTcpClient(uint32_t ip, uint16_t port, char *label, int num, void *
epoll_close
(
pThreadObj
->
pollFd
);
pThreadObj
->
pollFd
=
-
1
;
}
#else
#else
// __APPLE__
taosCloseSocket
(
pThreadObj
->
pollFd
);
#endif
#endif
// __APPLE__
free
(
pThreadObj
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
tError
(
"%s failed to create TCP read data thread(%s)"
,
label
,
strerror
(
errno
));
...
...
@@ -478,6 +478,9 @@ static void *taosProcessTcpData(void *param) {
struct
epoll_event
events
[
maxEvents
];
SRecvInfo
recvInfo
;
#ifdef __APPLE__
taos_block_sigalrm
();
#endif // __APPLE__
while
(
1
)
{
int
fdNum
=
epoll_wait
(
pThreadObj
->
pollFd
,
events
,
maxEvents
,
TAOS_EPOLL_WAIT_TIME
);
if
(
pThreadObj
->
stop
)
{
...
...
@@ -524,9 +527,9 @@ static void *taosProcessTcpData(void *param) {
epoll_close
(
pThreadObj
->
pollFd
);
pThreadObj
->
pollFd
=
-
1
;
}
#else
#else
// __APPLE__
if
(
pThreadObj
->
pollFd
>=
0
)
taosCloseSocket
(
pThreadObj
->
pollFd
);
#endif
#endif
// __APPLE__
while
(
pThreadObj
->
pHead
)
{
SFdObj
*
pFdObj
=
pThreadObj
->
pHead
;
...
...
src/sync/src/syncTcp.c
浏览文件 @
94eb0e1e
...
...
@@ -235,9 +235,9 @@ static void *syncProcessTcpData(void *param) {
#ifdef __APPLE__
epoll_close
(
pThread
->
pollFd
);
#else
#else
// __APPLE__
close
(
pThread
->
pollFd
);
#endif
#endif
// __APPLE__
tfree
(
pThread
);
tfree
(
buffer
);
return
NULL
;
...
...
@@ -296,9 +296,9 @@ static SThreadObj *syncGetTcpThread(SPoolObj *pPool) {
if
(
ret
!=
0
)
{
#ifdef __APPLE__
epoll_close
(
pThread
->
pollFd
);
#else
#else
// __APPLE__
close
(
pThread
->
pollFd
);
#endif
#endif
// __APPLE__
tfree
(
pThread
);
return
NULL
;
}
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
94eb0e1e
...
...
@@ -235,9 +235,9 @@ typedef struct {
STsdbFileH
*
tsdbFileH
;
#ifdef __APPLE__
sem_t
*
readyToCommit
;
#else
#else
// __APPLE__
sem_t
readyToCommit
;
#endif
#endif
// __APPLE__
pthread_mutex_t
mutex
;
bool
repoLocked
;
int32_t
code
;
// Commit code
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
94eb0e1e
...
...
@@ -168,9 +168,9 @@ static void tsdbEndCommit(STsdbRepo *pRepo, int eno) {
tsdbUnRefMemTable
(
pRepo
,
pIMem
);
#ifdef __APPLE__
sem_post
(
pRepo
->
readyToCommit
);
#else
#else
// __APPLE__
sem_post
(
&
(
pRepo
->
readyToCommit
));
#endif
#endif
// __APPLE__
}
static
int
tsdbHasDataToCommit
(
SCommitIter
*
iters
,
int
nIters
,
TSKEY
minKey
,
TSKEY
maxKey
)
{
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
94eb0e1e
...
...
@@ -148,9 +148,9 @@ int tsdbCloseRepo(TSDB_REPO_T *repo, int toCommit) {
tsdbAsyncCommit
(
pRepo
);
#ifdef __APPLE__
sem_wait
(
pRepo
->
readyToCommit
);
#else
#else
// __APPLE__
sem_wait
(
&
(
pRepo
->
readyToCommit
));
#endif
#endif
// __APPLE__
terrno
=
pRepo
->
code
;
}
tsdbUnRefMemTable
(
pRepo
,
pRepo
->
mem
);
...
...
@@ -654,14 +654,14 @@ static STsdbRepo *tsdbNewRepo(char *rootDir, STsdbAppH *pAppH, STsdbCfg *pCfg) {
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
goto
_err
;
}
#else
#else
// __APPLE__
code
=
sem_init
(
&
(
pRepo
->
readyToCommit
),
0
,
1
);
if
(
code
!=
0
)
{
code
=
errno
;
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
goto
_err
;
}
#endif
#endif
// __APPLE__
pRepo
->
repoLocked
=
false
;
...
...
@@ -709,9 +709,9 @@ static void tsdbFreeRepo(STsdbRepo *pRepo) {
tfree
(
pRepo
->
rootDir
);
#ifdef __APPLE__
sem_close
(
pRepo
->
readyToCommit
);
#else
#else
// __APPLE__
sem_destroy
(
&
(
pRepo
->
readyToCommit
));
#endif
#endif
// __APPLE__
pthread_mutex_destroy
(
&
pRepo
->
mutex
);
free
(
pRepo
);
}
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
94eb0e1e
...
...
@@ -209,9 +209,9 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) {
#ifdef __APPLE__
sem_wait
(
pRepo
->
readyToCommit
);
#else
#else
// __APPLE__
sem_wait
(
&
(
pRepo
->
readyToCommit
));
#endif
#endif
// __APPLE__
ASSERT
(
pRepo
->
imem
==
NULL
);
...
...
@@ -236,10 +236,10 @@ int tsdbSyncCommit(TSDB_REPO_T *repo) {
#ifdef __APPLE__
sem_wait
(
pRepo
->
readyToCommit
);
sem_post
(
pRepo
->
readyToCommit
);
#else
#else
// __APPLE__
sem_wait
(
&
(
pRepo
->
readyToCommit
));
sem_post
(
&
(
pRepo
->
readyToCommit
));
#endif
#endif
// __APPLE__
if
(
pRepo
->
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
pRepo
->
code
;
...
...
src/util/src/tsocket.c
浏览文件 @
94eb0e1e
...
...
@@ -376,7 +376,7 @@ int32_t taosKeepTcpAlive(SOCKET sockFd) {
taosCloseSocket
(
sockFd
);
return
-
1
;
}
#endif
#endif
// __APPLE__
int32_t
nodelay
=
1
;
if
(
taosSetSockOpt
(
sockFd
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
void
*
)
&
nodelay
,
sizeof
(
nodelay
))
<
0
)
{
...
...
tests/examples/c/epoll.c
浏览文件 @
94eb0e1e
...
...
@@ -15,9 +15,9 @@
#ifdef __APPLE__
#include "eok.h"
#else
#else
// __APPLE__
#include <sys/epoll.h>
#endif
#endif
// __APPLE__
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录