Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
1628e7a8
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看板
提交
1628e7a8
编写于
7月 15, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/feature/td-928' into feature/vnode
上级
e7fb1340
470cf1f6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
56 addition
and
46 deletion
+56
-46
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+1
-2
src/util/inc/tcache.h
src/util/inc/tcache.h
+1
-1
src/util/inc/tlockfree.h
src/util/inc/tlockfree.h
+52
-4
src/util/inc/trwlatch.h
src/util/inc/trwlatch.h
+0
-36
src/util/src/tlockfree.c
src/util/src/tlockfree.c
+1
-2
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
1628e7a8
...
...
@@ -24,7 +24,7 @@
#include "qtsbuf.h"
#include "taosdef.h"
#include "tarray.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "tsdb.h"
#include "tsqlfunction.h"
#include "query.h"
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
1628e7a8
...
...
@@ -21,11 +21,10 @@
#include "tkvstore.h"
#include "tlist.h"
#include "tlog.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "tsdb.h"
#include "tskiplist.h"
#include "tutil.h"
#include "trwlatch.h"
#ifdef __cplusplus
extern
"C"
{
...
...
src/util/inc/tcache.h
浏览文件 @
1628e7a8
...
...
@@ -21,7 +21,7 @@ extern "C" {
#endif
#include "os.h"
#include "t
ref
.h"
#include "t
lockfree
.h"
#include "hash.h"
typedef
void
(
*
__cache_free_fn_t
)(
void
*
);
...
...
src/util/inc/t
ref
.h
→
src/util/inc/t
lockfree
.h
浏览文件 @
1628e7a8
...
...
@@ -12,12 +12,17 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TREF_H
#define TDENGINE_TREF_H
#ifndef __TD_LOCK_FREE_H__
#define __TD_LOCK_FREE_H__
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// reference counting
typedef
void
(
*
_ref_fn_t
)(
const
void
*
pObj
);
#define T_REF_DECLARE() \
...
...
@@ -55,4 +60,47 @@ typedef void (*_ref_fn_t)(const void* pObj);
#define T_REF_VAL_GET(x) (x)->_ref.val
#endif // TDENGINE_TREF_H
// single writer multiple reader lock
typedef
int32_t
SRWLatch
;
void
taosInitRWLatch
(
SRWLatch
*
pLatch
);
void
taosWLockLatch
(
SRWLatch
*
pLatch
);
void
taosWUnLockLatch
(
SRWLatch
*
pLatch
);
void
taosRLockLatch
(
SRWLatch
*
pLatch
);
void
taosRUnLockLatch
(
SRWLatch
*
pLatch
);
// copy on read
#define taosCorBeginRead(x) for (uint32_t i_ = 1; 1; ++i_) { \
int32_t old_ = atomic_load_32(x); \
if (old_ & 0x00000001) { \
if (i_ % 1000 == 0) { \
sched_yield(); \
} \
continue; \
}
#define taosCorEndRead(x) \
if (atomic_load_32(x) == old_) { \
break; \
} \
}
#define taosCorBeginWrite(x) taosCorBeginRead(x) \
if (atomic_val_compare_exchange_32((x), old_, old_ + 1) != old_) { \
continue; \
}
#define taosCorEndWrite(x) atomic_add_fetch_32((x), 1); \
break; \
}
#ifdef __cplusplus
}
#endif
#endif
src/util/inc/trwlatch.h
已删除
100644 → 0
浏览文件 @
e7fb1340
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TD_RWLATCH_H__
#define __TD_RWLATCH_H__
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdint.h>
typedef
int32_t
SRWLatch
;
void
taosInitRWLatch
(
SRWLatch
*
pLatch
);
void
taosWLockLatch
(
SRWLatch
*
pLatch
);
void
taosWUnLockLatch
(
SRWLatch
*
pLatch
);
void
taosRLockLatch
(
SRWLatch
*
pLatch
);
void
taosRUnLockLatch
(
SRWLatch
*
pLatch
);
#ifdef __cplusplus
}
#endif
#endif
src/util/src/t
rwlatch
.c
→
src/util/src/t
lockfree
.c
浏览文件 @
1628e7a8
...
...
@@ -15,8 +15,7 @@
// #define _GNU_SOURCE
// #include <pthread.h>
#include "trwlatch.h"
#include "os.h"
#include "tlockfree.h"
#define TD_RWLATCH_WRITE_FLAG 0x40000000
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录