CGO DLL
This commit is contained in:
parent
e0d2bbe6d2
commit
3febe2ac0f
|
@ -183,9 +183,9 @@ IF (NOT DEFINED TD_CLUSTER)
|
|||
ENDIF ()
|
||||
ELSEIF (TD_WINDOWS_64)
|
||||
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-")
|
||||
SET(DEBUG_FLAGS "/Zi /W3 /GL")
|
||||
SET(RELEASE_FLAGS "/W0 /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(DEBUG_FLAGS "/Zi /W3 /GL")
|
||||
# SET(RELEASE_FLAGS "/W0 /GL")
|
||||
ADD_DEFINITIONS(-DWINDOWS)
|
||||
ADD_DEFINITIONS(-D__CLEANUP_C)
|
||||
ADD_DEFINITIONS(-DPTW32_STATIC_LIB)
|
||||
|
|
|
@ -175,7 +175,10 @@ static const struct alias sysdep_aliases[] = {
|
|||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
const struct alias *
|
||||
// gcc -o0 bug fix
|
||||
// see http://git.savannah.gnu.org/gitweb/?p=libiconv.git;a=blobdiff;f=lib/iconv.c;h=31853a7f1c47871221189dbf597473a16d8a8da7;hp=5a1a32597fa3efc5f69624d37a2eb96f308cd241;hb=b29089d8b43abc8fba073da7e6dccaeba56b2b70;hpb=0a04404c90d6a725b8b6bbcd65e10c5fcf5993e9
|
||||
|
||||
static const struct alias *
|
||||
aliases2_lookup (register const char *str)
|
||||
{
|
||||
const struct alias * ptr;
|
||||
|
|
|
@ -51,7 +51,7 @@ ELSEIF (TD_WINDOWS_64)
|
|||
|
||||
# generate dynamic library (*.dll)
|
||||
ADD_LIBRARY(taos SHARED ${SRC})
|
||||
SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
|
||||
# SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
|
||||
TARGET_LINK_LIBRARIES(taos trpc)
|
||||
|
||||
ELSEIF (TD_DARWIN_64)
|
||||
|
|
|
@ -57,10 +57,10 @@ typedef struct taosField {
|
|||
char type;
|
||||
} TAOS_FIELD;
|
||||
|
||||
void taos_init();
|
||||
int taos_options(TSDB_OPTION option, const void *arg, ...);
|
||||
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port);
|
||||
void taos_close(TAOS *taos);
|
||||
__declspec(dllexport) void taos_init();
|
||||
__declspec(dllexport) int taos_options(TSDB_OPTION option, const void *arg, ...);
|
||||
__declspec(dllexport) TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port);
|
||||
__declspec(dllexport) void taos_close(TAOS *taos);
|
||||
|
||||
typedef struct TAOS_BIND {
|
||||
int buffer_type;
|
||||
|
@ -80,18 +80,18 @@ int taos_stmt_execute(TAOS_STMT *stmt);
|
|||
TAOS_RES * taos_stmt_use_result(TAOS_STMT *stmt);
|
||||
int taos_stmt_close(TAOS_STMT *stmt);
|
||||
|
||||
int taos_query(TAOS *taos, const char *sql);
|
||||
TAOS_RES *taos_use_result(TAOS *taos);
|
||||
TAOS_ROW taos_fetch_row(TAOS_RES *res);
|
||||
int taos_result_precision(TAOS_RES *res); // get the time precision of result
|
||||
void taos_free_result(TAOS_RES *res);
|
||||
int taos_field_count(TAOS *taos);
|
||||
int taos_num_fields(TAOS_RES *res);
|
||||
int taos_affected_rows(TAOS *taos);
|
||||
TAOS_FIELD *taos_fetch_fields(TAOS_RES *res);
|
||||
int taos_select_db(TAOS *taos, const char *db);
|
||||
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields);
|
||||
void taos_stop_query(TAOS_RES *res);
|
||||
__declspec(dllexport) int taos_query(TAOS *taos, const char *sql);
|
||||
__declspec(dllexport) TAOS_RES *taos_use_result(TAOS *taos);
|
||||
__declspec(dllexport) TAOS_ROW taos_fetch_row(TAOS_RES *res);
|
||||
__declspec(dllexport) int taos_result_precision(TAOS_RES *res); // get the time precision of result
|
||||
__declspec(dllexport) void taos_free_result(TAOS_RES *res);
|
||||
__declspec(dllexport) int taos_field_count(TAOS *taos);
|
||||
__declspec(dllexport) int taos_num_fields(TAOS_RES *res);
|
||||
__declspec(dllexport) int taos_affected_rows(TAOS *taos);
|
||||
__declspec(dllexport) TAOS_FIELD *taos_fetch_fields(TAOS_RES *res);
|
||||
__declspec(dllexport) 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);
|
||||
__declspec(dllexport) void taos_stop_query(TAOS_RES *res);
|
||||
|
||||
int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows);
|
||||
int taos_validate_sql(TAOS *taos, const char *sql);
|
||||
|
@ -100,27 +100,27 @@ int taos_validate_sql(TAOS *taos, const char *sql);
|
|||
// TAOS_RES *taos_list_dbs(TAOS *mysql, const char *wild);
|
||||
|
||||
// TODO: the return value should be `const`
|
||||
char *taos_get_server_info(TAOS *taos);
|
||||
char *taos_get_client_info();
|
||||
char *taos_errstr(TAOS *taos);
|
||||
__declspec(dllexport) char *taos_get_server_info(TAOS *taos);
|
||||
__declspec(dllexport) char *taos_get_client_info();
|
||||
__declspec(dllexport) char *taos_errstr(TAOS *taos);
|
||||
|
||||
int taos_errno(TAOS *taos);
|
||||
__declspec(dllexport) int taos_errno(TAOS *taos);
|
||||
|
||||
void taos_query_a(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, int code), void *param);
|
||||
void taos_fetch_rows_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, int numOfRows), void *param);
|
||||
void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);
|
||||
__declspec(dllexport) 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);
|
||||
__declspec(dllexport) void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);
|
||||
|
||||
TAOS_SUB *taos_subscribe(const char *host, const char *user, const char *pass, const char *db, const char *table, int64_t time, int mseconds);
|
||||
TAOS_ROW taos_consume(TAOS_SUB *tsub);
|
||||
void taos_unsubscribe(TAOS_SUB *tsub);
|
||||
int taos_subfields_count(TAOS_SUB *tsub);
|
||||
TAOS_FIELD *taos_fetch_subfields(TAOS_SUB *tsub);
|
||||
__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);
|
||||
__declspec(dllexport) TAOS_ROW taos_consume(TAOS_SUB *tsub);
|
||||
__declspec(dllexport) void taos_unsubscribe(TAOS_SUB *tsub);
|
||||
__declspec(dllexport) int taos_subfields_count(TAOS_SUB *tsub);
|
||||
__declspec(dllexport) TAOS_FIELD *taos_fetch_subfields(TAOS_SUB *tsub);
|
||||
|
||||
TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row),
|
||||
__declspec(dllexport) 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 *));
|
||||
void taos_close_stream(TAOS_STREAM *tstr);
|
||||
__declspec(dllexport) void taos_close_stream(TAOS_STREAM *tstr);
|
||||
|
||||
int taos_load_table_info(TAOS *taos, const char* tableNameList);
|
||||
__declspec(dllexport) int taos_load_table_info(TAOS *taos, const char* tableNameList);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
#define TDENGINE_PLATFORM_WINDOWS_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <float.h>
|
||||
#include <locale.h>
|
||||
#include <intrin.h>
|
||||
|
@ -35,13 +35,15 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <inttypes.h>
|
||||
#include "winsock2.h"
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
#include <winbase.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -75,10 +77,12 @@ extern "C" {
|
|||
#define strncasecmp _strnicmp
|
||||
#define wcsncasecmp _wcsnicmp
|
||||
#define strtok_r strtok_s
|
||||
#define str2int64 _atoi64
|
||||
// #define str2int64 _atoi64
|
||||
int64_t str2int64(char *str);
|
||||
#define snprintf _snprintf
|
||||
#define in_addr_t unsigned long
|
||||
#define socklen_t int
|
||||
uint64_t htonll(uint64_t val);
|
||||
#define htobe64 htonll
|
||||
#define twrite write
|
||||
|
||||
|
@ -136,7 +140,8 @@ extern "C" {
|
|||
#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_val_compare_exchange_8(ptr, oldval, newval) _InterlockedCompareExchange8((char volatile*)(ptr), (char)(newval), (char)(oldval))
|
||||
// #define atomic_val_compare_exchange_8(ptr, oldval, newval) _InterlockedCompareExchange8((char volatile*)(ptr), (char)(newval), (char)(oldval))
|
||||
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
|
||||
#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_64(ptr, oldval, newval) _InterlockedCompareExchange64((__int64 volatile*)(ptr), (__int64)(newval), (__int64)(oldval))
|
||||
|
@ -157,8 +162,10 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
|||
#define atomic_add_fetch_ptr atomic_add_fetch_32
|
||||
#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(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_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
|
||||
#ifdef _WIN64
|
||||
|
@ -187,13 +194,13 @@ __int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
|||
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
|
||||
#endif
|
||||
|
||||
char interlocked_and_fetch_8(char volatile* ptr, char val);
|
||||
short interlocked_and_fetch_16(short volatile* ptr, short val);
|
||||
// char interlocked_and_fetch_8(char volatile* ptr, char val);
|
||||
// short interlocked_and_fetch_16(short volatile* ptr, short val);
|
||||
long interlocked_and_fetch_32(long volatile* ptr, long 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))
|
||||
#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))
|
||||
#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))
|
||||
#ifdef _WIN64
|
||||
|
@ -202,8 +209,8 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define atomic_and_fetch_ptr atomic_and_fetch_32
|
||||
#endif
|
||||
|
||||
#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_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_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
@ -219,13 +226,13 @@ __int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define atomic_fetch_and_ptr atomic_fetch_and_32
|
||||
#endif
|
||||
|
||||
char interlocked_or_fetch_8(char volatile* ptr, char val);
|
||||
short interlocked_or_fetch_16(short volatile* ptr, short val);
|
||||
// char interlocked_or_fetch_8(char volatile* ptr, char val);
|
||||
// short interlocked_or_fetch_16(short volatile* ptr, short val);
|
||||
long interlocked_or_fetch_32(long volatile* ptr, long 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))
|
||||
#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))
|
||||
#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))
|
||||
#ifdef _WIN64
|
||||
|
@ -234,8 +241,8 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define atomic_or_fetch_ptr atomic_or_fetch_32
|
||||
#endif
|
||||
|
||||
#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_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_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
@ -251,13 +258,13 @@ __int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define atomic_fetch_or_ptr atomic_fetch_or_32
|
||||
#endif
|
||||
|
||||
char interlocked_xor_fetch_8(char volatile* ptr, char val);
|
||||
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);
|
||||
long interlocked_xor_fetch_32(long volatile* ptr, long 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))
|
||||
#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))
|
||||
#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))
|
||||
#ifdef _WIN64
|
||||
|
@ -266,8 +273,8 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
|
||||
#endif
|
||||
|
||||
#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))
|
||||
// #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))
|
||||
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
@ -293,7 +300,8 @@ __int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
|||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
|
||||
#define MILLISECOND_PER_SECOND (1000i64)
|
||||
// #define MILLISECOND_PER_SECOND (1000i64)
|
||||
#define MILLISECOND_PER_SECOND (1000LL)
|
||||
|
||||
#define tsem_t sem_t
|
||||
#define tsem_init sem_init
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include "tsdb.h"
|
||||
#include "tglobalcfg.h"
|
||||
|
||||
#include <intrin.h>
|
||||
#include <winbase.h>
|
||||
#include <Winsock2.h>
|
||||
|
||||
char configDir[TSDB_FILENAME_LEN] = "C:/TDengine/cfg";
|
||||
char tsDirectory[TSDB_FILENAME_LEN] = "C:/TDengine/data";
|
||||
char logDir[TSDB_FILENAME_LEN] = "C:/TDengine/log";
|
||||
|
@ -67,12 +71,20 @@ int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optle
|
|||
}
|
||||
|
||||
// add
|
||||
// char interlocked_add_fetch_8(char volatile* ptr, char val) {
|
||||
// return _InterlockedExchangeAdd8(ptr, val) + val;
|
||||
// }
|
||||
|
||||
// short interlocked_add_fetch_16(short volatile* ptr, short val) {
|
||||
// return _InterlockedExchangeAdd16(ptr, val) + val;
|
||||
// }
|
||||
|
||||
char interlocked_add_fetch_8(char volatile* ptr, char val) {
|
||||
return _InterlockedExchangeAdd8(ptr, val) + val;
|
||||
return __sync_fetch_and_add(ptr, val) + val;
|
||||
}
|
||||
|
||||
short interlocked_add_fetch_16(short volatile* ptr, short val) {
|
||||
return _InterlockedExchangeAdd16(ptr, val) + val;
|
||||
return __sync_fetch_and_add(ptr, val) + val;
|
||||
}
|
||||
|
||||
long interlocked_add_fetch_32(long volatile* ptr, long val) {
|
||||
|
@ -84,13 +96,13 @@ __int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|||
}
|
||||
|
||||
// and
|
||||
char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||
return _InterlockedAnd8(ptr, val) & val;
|
||||
}
|
||||
// char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||
// return _InterlockedAnd8(ptr, val) & val;
|
||||
// }
|
||||
|
||||
short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
||||
return _InterlockedAnd16(ptr, val) & val;
|
||||
}
|
||||
// short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
||||
// return _InterlockedAnd16(ptr, val) & val;
|
||||
// }
|
||||
|
||||
long interlocked_and_fetch_32(long volatile* ptr, long val) {
|
||||
return _InterlockedAnd(ptr, val) & val;
|
||||
|
@ -124,13 +136,13 @@ __int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
|
|||
#endif
|
||||
|
||||
// or
|
||||
char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||
return _InterlockedOr8(ptr, val) | val;
|
||||
}
|
||||
// char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||
// return _InterlockedOr8(ptr, val) | val;
|
||||
// }
|
||||
|
||||
short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
||||
return _InterlockedOr16(ptr, val) | val;
|
||||
}
|
||||
// short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
||||
// return _InterlockedOr16(ptr, val) | val;
|
||||
// }
|
||||
|
||||
long interlocked_or_fetch_32(long volatile* ptr, long val) {
|
||||
return _InterlockedOr(ptr, val) | val;
|
||||
|
@ -164,13 +176,13 @@ __int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
|
|||
#endif
|
||||
|
||||
// xor
|
||||
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||
return _InterlockedXor8(ptr, val) ^ val;
|
||||
}
|
||||
// char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||
// return _InterlockedXor8(ptr, val) ^ val;
|
||||
// }
|
||||
|
||||
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
||||
return _InterlockedXor16(ptr, val) ^ val;
|
||||
}
|
||||
// short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
||||
// return _InterlockedXor16(ptr, val) ^ val;
|
||||
// }
|
||||
|
||||
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
|
||||
return _InterlockedXor(ptr, val) ^ val;
|
||||
|
@ -396,4 +408,14 @@ char *strndup(const char *s, size_t n) {
|
|||
return r;
|
||||
}
|
||||
|
||||
void taosSetCoreDump() {}
|
||||
void taosSetCoreDump() {}
|
||||
|
||||
int64_t str2int64(char *str) {
|
||||
char *endptr = NULL;
|
||||
return strtoll(str, &endptr, 10);
|
||||
}
|
||||
|
||||
uint64_t htonll(uint64_t val)
|
||||
{
|
||||
return (((uint64_t) htonl(val)) << 32) + htonl(val >> 32);
|
||||
}
|
Loading…
Reference in New Issue