|
@@ -278,13 +278,20 @@ int bbThreadResume( BBThread *thread ){
|
|
#endif
|
|
#endif
|
|
|
|
|
|
//***** Atomic ops *****
|
|
//***** Atomic ops *****
|
|
-
|
|
|
|
int bbAtomicCAS( volatile int *addr,int old,int new_val ){
|
|
int bbAtomicCAS( volatile int *addr,int old,int new_val ){
|
|
- return AO_compare_and_swap(addr, old, new_val);
|
|
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
+ return AO_int_compare_and_swap(addr, old, new_val);
|
|
|
|
+#else
|
|
|
|
+ return __sync_val_compare_and_swap(addr, old, new_val);
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
int bbAtomicAdd( volatile int *p,int incr ){
|
|
int bbAtomicAdd( volatile int *p,int incr ){
|
|
|
|
+#ifndef __ANDROID__
|
|
return AO_fetch_and_add((AO_t*)p, incr);
|
|
return AO_fetch_and_add((AO_t*)p, incr);
|
|
|
|
+#else
|
|
|
|
+ return __sync_fetch_and_add(p, incr);
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
#endif // __EMSCRIPTEN__
|
|
#endif // __EMSCRIPTEN__
|