sync: enable Android support (#9790)
parent
4a1e2f9dcc
commit
8710a0b7b1
|
@ -3,11 +3,12 @@ module sync
|
||||||
import time
|
import time
|
||||||
import rand
|
import rand
|
||||||
|
|
||||||
#flag windows -I @VROOT/thirdparty/stdatomic/win
|
|
||||||
#flag linux -I @VROOT/thirdparty/stdatomic/nix
|
$if windows {
|
||||||
#flag darwin -I @VROOT/thirdparty/stdatomic/nix
|
#flag -I @VROOT/thirdparty/stdatomic/win
|
||||||
#flag freebsd -I @VROOT/thirdparty/stdatomic/nix
|
} $else {
|
||||||
#flag solaris -I @VROOT/thirdparty/stdatomic/nix
|
#flag -I @VROOT/thirdparty/stdatomic/nix
|
||||||
|
}
|
||||||
|
|
||||||
$if linux {
|
$if linux {
|
||||||
$if tinyc {
|
$if tinyc {
|
||||||
|
@ -24,8 +25,7 @@ $if linux {
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <atomic.h>
|
#include <atomic.h>
|
||||||
|
// The following functions are actually generic in C
|
||||||
// the following functions are actually generic in C
|
|
||||||
fn C.atomic_load_ptr(voidptr) voidptr
|
fn C.atomic_load_ptr(voidptr) voidptr
|
||||||
fn C.atomic_store_ptr(voidptr, voidptr)
|
fn C.atomic_store_ptr(voidptr, voidptr)
|
||||||
fn C.atomic_compare_exchange_weak_ptr(voidptr, voidptr, voidptr) bool
|
fn C.atomic_compare_exchange_weak_ptr(voidptr, voidptr, voidptr) bool
|
||||||
|
|
|
@ -5,7 +5,12 @@ module sync
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
// There's no additional linking (-lpthread) needed for Android.
|
||||||
|
// See https://stackoverflow.com/a/31277163/1904615
|
||||||
|
$if !android {
|
||||||
#flag -lpthread
|
#flag -lpthread
|
||||||
|
}
|
||||||
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
[trusted]
|
[trusted]
|
||||||
|
|
Loading…
Reference in New Issue