Fix compile errors on different platforms
This commit is contained in:
parent
24565c3490
commit
02798e10d8
|
@ -68,7 +68,7 @@ void jniGetGlobalMethod(JNIEnv *env) {
|
||||||
case 1:
|
case 1:
|
||||||
do {
|
do {
|
||||||
taosMsleep(0);
|
taosMsleep(0);
|
||||||
} while (__atomic_load_n(&__init, __ATOMIC_ACQUIRE) == 1);
|
} while (__sync_val_load_32(&__init) == 1);
|
||||||
case 2:
|
case 2:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void jniGetGlobalMethod(JNIEnv *env) {
|
||||||
g_rowdataSetByteArrayFp = (*env)->GetMethodID(env, g_rowdataClass, "setByteArray", "(I[B)V");
|
g_rowdataSetByteArrayFp = (*env)->GetMethodID(env, g_rowdataClass, "setByteArray", "(I[B)V");
|
||||||
(*env)->DeleteLocalRef(env, rowdataClass);
|
(*env)->DeleteLocalRef(env, rowdataClass);
|
||||||
|
|
||||||
__atomic_store_n(&__init, 2, __ATOMIC_RELEASE);
|
__sync_val_restore_32(&__init, 2);
|
||||||
jniTrace("native method register finished");
|
jniTrace("native method register finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
#define __sync_val_compare_and_swap_32 __sync_val_compare_and_swap
|
#define __sync_val_compare_and_swap_32 __sync_val_compare_and_swap
|
||||||
#define __sync_add_and_fetch_64 __sync_add_and_fetch
|
#define __sync_add_and_fetch_64 __sync_add_and_fetch
|
||||||
#define __sync_add_and_fetch_32 __sync_add_and_fetch
|
#define __sync_add_and_fetch_32 __sync_add_and_fetch
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr);
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval);
|
||||||
|
|
||||||
#define SWAP(a, b, c) \
|
#define SWAP(a, b, c) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -415,4 +415,12 @@ int tsem_post(dispatch_semaphore_t *sem) {
|
||||||
|
|
||||||
int tsem_destroy(dispatch_semaphore_t *sem) {
|
int tsem_destroy(dispatch_semaphore_t *sem) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr) {
|
||||||
|
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval) {
|
||||||
|
__atomic_store_n(ptr, newval, __ATOMIC_RELEASE);
|
||||||
}
|
}
|
|
@ -62,6 +62,8 @@
|
||||||
#define __sync_val_compare_and_swap_32 __sync_val_compare_and_swap
|
#define __sync_val_compare_and_swap_32 __sync_val_compare_and_swap
|
||||||
#define __sync_add_and_fetch_64 __sync_add_and_fetch
|
#define __sync_add_and_fetch_64 __sync_add_and_fetch
|
||||||
#define __sync_add_and_fetch_32 __sync_add_and_fetch
|
#define __sync_add_and_fetch_32 __sync_add_and_fetch
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr);
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval);
|
||||||
|
|
||||||
#define SWAP(a, b, c) \
|
#define SWAP(a, b, c) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -339,4 +339,12 @@ bool taosSkipSocketCheck() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr) {
|
||||||
|
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval) {
|
||||||
|
__atomic_store_n(ptr, newval, __ATOMIC_RELEASE);
|
||||||
|
}
|
||||||
|
|
|
@ -78,6 +78,8 @@ int32_t __sync_val_compare_and_swap_32(int32_t *ptr, int32_t oldval, int32_t new
|
||||||
int32_t __sync_add_and_fetch_32(int32_t *ptr, int32_t val);
|
int32_t __sync_add_and_fetch_32(int32_t *ptr, int32_t val);
|
||||||
int64_t __sync_val_compare_and_swap_64(int64_t *ptr, int64_t oldval, int64_t newval);
|
int64_t __sync_val_compare_and_swap_64(int64_t *ptr, int64_t oldval, int64_t newval);
|
||||||
int64_t __sync_add_and_fetch_64(int64_t *ptr, int64_t val);
|
int64_t __sync_add_and_fetch_64(int64_t *ptr, int64_t val);
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr);
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval);
|
||||||
|
|
||||||
#define SWAP(a, b, c) \
|
#define SWAP(a, b, c) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -151,6 +153,8 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
|
|
||||||
int flock(int fd, int option);
|
int flock(int fd, int option);
|
||||||
|
|
||||||
|
int fsync(int filedes);
|
||||||
|
|
||||||
char *getpass(const char *prefix);
|
char *getpass(const char *prefix);
|
||||||
|
|
||||||
char *strsep(char **stringp, const char *delim);
|
char *strsep(char **stringp, const char *delim);
|
||||||
|
|
|
@ -47,7 +47,7 @@ int64_t taosGetPthreadId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optlen) {
|
int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optlen) {
|
||||||
if (level == SOL_TCP && optname == TCP_KEEPCNT) {
|
if (level == SOL_SOCKET && optname == TCP_KEEPCNT) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,14 @@ int64_t __sync_add_and_fetch_64(int64_t *ptr, int64_t val) {
|
||||||
return InterlockedAdd64(ptr, val);
|
return InterlockedAdd64(ptr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t __sync_val_load_32(int32_t *ptr) {
|
||||||
|
return InterlockedOr(ptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __sync_val_restore_32(int32_t *ptr, int32_t newval) {
|
||||||
|
InterlockedCompareExchange(ptr, *ptr, newval);
|
||||||
|
}
|
||||||
|
|
||||||
void tsPrintOsInfo() {}
|
void tsPrintOsInfo() {}
|
||||||
|
|
||||||
char *taosCharsetReplace(char *charsetstr) {
|
char *taosCharsetReplace(char *charsetstr) {
|
||||||
|
@ -178,6 +186,10 @@ int flock(int fd, int option) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fsync(int filedes) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int sigaction(int sig, struct sigaction *d, void *p) {
|
int sigaction(int sig, struct sigaction *d, void *p) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue