Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d9a3b9da
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看板
提交
d9a3b9da
编写于
1月 04, 2020
作者:
L
lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[#1054]
上级
2aae18dd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
113 addition
and
68 deletion
+113
-68
CMakeLists.txt
CMakeLists.txt
+12
-3
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+3
-1
src/inc/taos.h
src/inc/taos.h
+37
-31
src/os/windows/inc/os.h
src/os/windows/inc/os.h
+61
-33
未找到文件。
CMakeLists.txt
浏览文件 @
d9a3b9da
...
@@ -26,6 +26,13 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
...
@@ -26,6 +26,13 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
# open the file named TDengine.sln
# open the file named TDengine.sln
#
#
SET
(
TD_GODLL FALSE
)
IF
(
${
DLLTYPE
}
MATCHES
"go"
)
ADD_DEFINITIONS
(
-D_TD_GO_DLL_
)
MESSAGE
(
STATUS
"input dll type: "
${
DLLTYPE
}
)
SET
(
TD_GODLL TRUE
)
ENDIF
()
IF
(
NOT DEFINED TD_CLUSTER
)
IF
(
NOT DEFINED TD_CLUSTER
)
MESSAGE
(
STATUS
"Build the Lite Version"
)
MESSAGE
(
STATUS
"Build the Lite Version"
)
SET
(
TD_CLUSTER FALSE
)
SET
(
TD_CLUSTER FALSE
)
...
@@ -183,9 +190,11 @@ IF (NOT DEFINED TD_CLUSTER)
...
@@ -183,9 +190,11 @@ IF (NOT DEFINED TD_CLUSTER)
ENDIF
()
ENDIF
()
ELSEIF
(
TD_WINDOWS_64
)
ELSEIF
(
TD_WINDOWS_64
)
SET
(
CMAKE_GENERATOR
"NMake Makefiles"
CACHE INTERNAL
""
FORCE
)
SET
(
CMAKE_GENERATOR
"NMake Makefiles"
CACHE INTERNAL
""
FORCE
)
# SET(COMMON_FLAGS "/nologo /WX- /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
IF
(
NOT TD_GODLL
)
# SET(DEBUG_FLAGS "/Zi /W3 /GL")
SET
(
COMMON_FLAGS
"/nologo /WX- /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-"
)
# SET(RELEASE_FLAGS "/W0 /GL")
SET
(
DEBUG_FLAGS
"/Zi /W3 /GL"
)
SET
(
RELEASE_FLAGS
"/W0 /GL"
)
ENDIF
()
ADD_DEFINITIONS
(
-DWINDOWS
)
ADD_DEFINITIONS
(
-DWINDOWS
)
ADD_DEFINITIONS
(
-D__CLEANUP_C
)
ADD_DEFINITIONS
(
-D__CLEANUP_C
)
ADD_DEFINITIONS
(
-DPTW32_STATIC_LIB
)
ADD_DEFINITIONS
(
-DPTW32_STATIC_LIB
)
...
...
src/client/CMakeLists.txt
浏览文件 @
d9a3b9da
...
@@ -51,7 +51,9 @@ ELSEIF (TD_WINDOWS_64)
...
@@ -51,7 +51,9 @@ ELSEIF (TD_WINDOWS_64)
# generate dynamic library (*.dll)
# generate dynamic library (*.dll)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
)
# SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
IF
(
NOT TD_GODLL
)
SET_TARGET_PROPERTIES
(
taos PROPERTIES LINK_FLAGS /DEF:
${
TD_COMMUNITY_DIR
}
/src/client/src/taos.def
)
ENDIF
()
TARGET_LINK_LIBRARIES
(
taos trpc
)
TARGET_LINK_LIBRARIES
(
taos trpc
)
ELSEIF
(
TD_DARWIN_64
)
ELSEIF
(
TD_DARWIN_64
)
...
...
src/inc/taos.h
浏览文件 @
d9a3b9da
...
@@ -57,10 +57,16 @@ typedef struct taosField {
...
@@ -57,10 +57,16 @@ typedef struct taosField {
char
type
;
char
type
;
}
TAOS_FIELD
;
}
TAOS_FIELD
;
__declspec
(
dllexport
)
void
taos_init
();
#ifdef _TD_GO_DLL_
__declspec
(
dllexport
)
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
#define DLL_EXPORT __declspec(dllexport)
__declspec
(
dllexport
)
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
#else
__declspec
(
dllexport
)
void
taos_close
(
TAOS
*
taos
);
#define DLL_EXPORT
#endif
DLL_EXPORT
void
taos_init
();
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
typedef
struct
TAOS_BIND
{
typedef
struct
TAOS_BIND
{
int
buffer_type
;
int
buffer_type
;
...
@@ -80,18 +86,18 @@ int taos_stmt_execute(TAOS_STMT *stmt);
...
@@ -80,18 +86,18 @@ int taos_stmt_execute(TAOS_STMT *stmt);
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
__declspec
(
dllexport
)
int
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
int
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
__declspec
(
dllexport
)
TAOS_RES
*
taos_use_result
(
TAOS
*
taos
);
DLL_EXPORT
TAOS_RES
*
taos_use_result
(
TAOS
*
taos
);
__declspec
(
dllexport
)
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
__declspec
(
dllexport
)
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
__declspec
(
dllexport
)
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
__declspec
(
dllexport
)
int
taos_field_count
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_field_count
(
TAOS
*
taos
);
__declspec
(
dllexport
)
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
__declspec
(
dllexport
)
int
taos_affected_rows
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS
*
taos
);
__declspec
(
dllexport
)
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
__declspec
(
dllexport
)
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
__declspec
(
dllexport
)
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
__declspec
(
dllexport
)
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
...
@@ -100,27 +106,27 @@ int taos_validate_sql(TAOS *taos, const char *sql);
...
@@ -100,27 +106,27 @@ int taos_validate_sql(TAOS *taos, const char *sql);
// TAOS_RES *taos_list_dbs(TAOS *mysql, const char *wild);
// TAOS_RES *taos_list_dbs(TAOS *mysql, const char *wild);
// TODO: the return value should be `const`
// TODO: the return value should be `const`
__declspec
(
dllexport
)
char
*
taos_get_server_info
(
TAOS
*
taos
);
DLL_EXPORT
char
*
taos_get_server_info
(
TAOS
*
taos
);
__declspec
(
dllexport
)
char
*
taos_get_client_info
();
DLL_EXPORT
char
*
taos_get_client_info
();
__declspec
(
dllexport
)
char
*
taos_errstr
(
TAOS
*
taos
);
DLL_EXPORT
char
*
taos_errstr
(
TAOS
*
taos
);
__declspec
(
dllexport
)
int
taos_errno
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_errno
(
TAOS
*
taos
);
__declspec
(
dllexport
)
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
code
),
void
*
param
);
DLL_EXPORT
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
code
),
void
*
param
);
__declspec
(
dllexport
)
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
numOfRows
),
void
*
param
);
DLL_EXPORT
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
numOfRows
),
void
*
param
);
__declspec
(
dllexport
)
void
taos_fetch_row_a
(
TAOS_RES
*
res
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
void
*
param
);
DLL_EXPORT
void
taos_fetch_row_a
(
TAOS_RES
*
res
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
void
*
param
);
__declspec
(
dllexport
)
TAOS_SUB
*
taos_subscribe
(
const
char
*
host
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
const
char
*
table
,
int64_t
time
,
int
mseconds
);
DLL_EXPORT
TAOS_SUB
*
taos_subscribe
(
const
char
*
host
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
const
char
*
table
,
int64_t
time
,
int
mseconds
);
__declspec
(
dllexport
)
TAOS_ROW
taos_consume
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
TAOS_ROW
taos_consume
(
TAOS_SUB
*
tsub
);
__declspec
(
dllexport
)
void
taos_unsubscribe
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
void
taos_unsubscribe
(
TAOS_SUB
*
tsub
);
__declspec
(
dllexport
)
int
taos_subfields_count
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
int
taos_subfields_count
(
TAOS_SUB
*
tsub
);
__declspec
(
dllexport
)
TAOS_FIELD
*
taos_fetch_subfields
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_subfields
(
TAOS_SUB
*
tsub
);
__declspec
(
dllexport
)
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
DLL_EXPORT
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
));
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
));
__declspec
(
dllexport
)
void
taos_close_stream
(
TAOS_STREAM
*
tstr
);
DLL_EXPORT
void
taos_close_stream
(
TAOS_STREAM
*
tstr
);
__declspec
(
dllexport
)
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/os/windows/inc/os.h
浏览文件 @
d9a3b9da
...
@@ -77,12 +77,16 @@ extern "C" {
...
@@ -77,12 +77,16 @@ extern "C" {
#define strncasecmp _strnicmp
#define strncasecmp _strnicmp
#define wcsncasecmp _wcsnicmp
#define wcsncasecmp _wcsnicmp
#define strtok_r strtok_s
#define strtok_r strtok_s
// #define str2int64 _atoi64
#ifdef _TD_GO_DLL_
int64_t
str2int64
(
char
*
str
);
int64_t
str2int64
(
char
*
str
);
uint64_t
htonll
(
uint64_t
val
);
#else
#define str2int64 _atoi64
#endif
#define snprintf _snprintf
#define snprintf _snprintf
#define in_addr_t unsigned long
#define in_addr_t unsigned long
#define socklen_t int
#define socklen_t int
uint64_t
htonll
(
uint64_t
val
);
#define htobe64 htonll
#define htobe64 htonll
#define twrite write
#define twrite write
...
@@ -140,8 +144,12 @@ uint64_t htonll(uint64_t val);
...
@@ -140,8 +144,12 @@ uint64_t htonll(uint64_t val);
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
// #define atomic_val_compare_exchange_8(ptr, oldval, newval) _InterlockedCompareExchange8((char volatile*)(ptr), (char)(newval), (char)(oldval))
#ifdef _TD_GO_DLL_
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
#else
#define atomic_val_compare_exchange_8(ptr, oldval, newval) _InterlockedCompareExchange8((char volatile*)(ptr), (char)(newval), (char)(oldval))
#endif
#define atomic_val_compare_exchange_16(ptr, oldval, newval) _InterlockedCompareExchange16((short volatile*)(ptr), (short)(newval), (short)(oldval))
#define atomic_val_compare_exchange_16(ptr, oldval, newval) _InterlockedCompareExchange16((short volatile*)(ptr), (short)(newval), (short)(oldval))
#define atomic_val_compare_exchange_32(ptr, oldval, newval) _InterlockedCompareExchange((long volatile*)(ptr), (long)(newval), (long)(oldval))
#define atomic_val_compare_exchange_32(ptr, oldval, newval) _InterlockedCompareExchange((long volatile*)(ptr), (long)(newval), (long)(oldval))
#define atomic_val_compare_exchange_64(ptr, oldval, newval) _InterlockedCompareExchange64((__int64 volatile*)(ptr), (__int64)(newval), (__int64)(oldval))
#define atomic_val_compare_exchange_64(ptr, oldval, newval) _InterlockedCompareExchange64((__int64 volatile*)(ptr), (__int64)(newval), (__int64)(oldval))
...
@@ -161,11 +169,14 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
...
@@ -161,11 +169,14 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
#else
#else
#define atomic_add_fetch_ptr atomic_add_fetch_32
#define atomic_add_fetch_ptr atomic_add_fetch_32
#endif
#endif
#ifdef _TD_GO_DLL_
#define atomic_fetch_add_8 __sync_fetch_and_ad
#define atomic_fetch_add_16 __sync_fetch_and_add
#else
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
#endif
// #define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
// #define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_add_8 __sync_fetch_and_ad
#define atomic_fetch_add_16 __sync_fetch_and_add
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#ifdef _WIN64
...
@@ -193,14 +204,17 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
...
@@ -193,14 +204,17 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
#else
#else
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
#endif
#endif
#ifndef _TD_GO_DLL_
// char interlocked_and_fetch_8(char volatile* ptr, char val);
char
interlocked_and_fetch_8
(
char
volatile
*
ptr
,
char
val
);
// short interlocked_and_fetch_16(short volatile* ptr, short val);
short
interlocked_and_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
);
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
// #define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
#ifndef _TD_GO_DLL_
// #define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#ifdef _WIN64
...
@@ -208,9 +222,10 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -208,9 +222,10 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
#else
#else
#define atomic_and_fetch_ptr atomic_and_fetch_32
#define atomic_and_fetch_ptr atomic_and_fetch_32
#endif
#endif
#ifndef _TD_GO_DLL_
// #define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
// #define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
#ifdef _M_IX86
#ifdef _M_IX86
...
@@ -225,14 +240,17 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -225,14 +240,17 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
#else
#else
#define atomic_fetch_and_ptr atomic_fetch_and_32
#define atomic_fetch_and_ptr atomic_fetch_and_32
#endif
#endif
#ifndef _TD_GO_DLL_
// char interlocked_or_fetch_8(char volatile* ptr, char val);
char
interlocked_or_fetch_8
(
char
volatile
*
ptr
,
char
val
);
// short interlocked_or_fetch_16(short volatile* ptr, short val);
short
interlocked_or_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
);
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
// #define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
#ifndef _TD_GO_DLL_
// #define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#ifdef _WIN64
...
@@ -240,9 +258,10 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -240,9 +258,10 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
#else
#else
#define atomic_or_fetch_ptr atomic_or_fetch_32
#define atomic_or_fetch_ptr atomic_or_fetch_32
#endif
#endif
#ifndef _TD_GO_DLL_
// #define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
// #define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
#ifdef _M_IX86
#ifdef _M_IX86
...
@@ -258,13 +277,17 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -258,13 +277,17 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
#define atomic_fetch_or_ptr atomic_fetch_or_32
#define atomic_fetch_or_ptr atomic_fetch_or_32
#endif
#endif
// char interlocked_xor_fetch_8(char volatile* ptr, char val);
#ifndef _TD_GO_DLL_
// short interlocked_xor_fetch_16(short volatile* ptr, short val);
char
interlocked_xor_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_xor_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
);
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
// #define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
#ifndef _TD_GO_DLL_
// #define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#ifdef _WIN64
...
@@ -273,8 +296,10 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -273,8 +296,10 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
#endif
#endif
// #define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
#ifndef _TD_GO_DLL_
// #define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
#ifdef _M_IX86
#ifdef _M_IX86
...
@@ -300,8 +325,11 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
...
@@ -300,8 +325,11 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
// #define MILLISECOND_PER_SECOND (1000i64)
#ifdef _TD_GO_DLL_
#define MILLISECOND_PER_SECOND (1000LL)
#define MILLISECOND_PER_SECOND (1000LL)
#else
#define MILLISECOND_PER_SECOND (1000i64)
#endif
#define tsem_t sem_t
#define tsem_t sem_t
#define tsem_init sem_init
#define tsem_init sem_init
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录