diff --git a/vlib/sync/channels.v b/vlib/sync/channels.v index bda7135421..61247233db 100644 --- a/vlib/sync/channels.v +++ b/vlib/sync/channels.v @@ -3,11 +3,12 @@ module sync import time import rand -#flag windows -I @VROOT/thirdparty/stdatomic/win -#flag linux -I @VROOT/thirdparty/stdatomic/nix -#flag darwin -I @VROOT/thirdparty/stdatomic/nix -#flag freebsd -I @VROOT/thirdparty/stdatomic/nix -#flag solaris -I @VROOT/thirdparty/stdatomic/nix + +$if windows { + #flag -I @VROOT/thirdparty/stdatomic/win +} $else { + #flag -I @VROOT/thirdparty/stdatomic/nix +} $if linux { $if tinyc { @@ -24,8 +25,7 @@ $if linux { } #include - -// 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_store_ptr(voidptr, voidptr) fn C.atomic_compare_exchange_weak_ptr(voidptr, voidptr, voidptr) bool diff --git a/vlib/sync/sync_default.c.v b/vlib/sync/sync_default.c.v index 244d8dd367..37d0c27226 100644 --- a/vlib/sync/sync_default.c.v +++ b/vlib/sync/sync_default.c.v @@ -5,7 +5,12 @@ module sync import time -#flag -lpthread +// There's no additional linking (-lpthread) needed for Android. +// See https://stackoverflow.com/a/31277163/1904615 +$if !android { + #flag -lpthread +} + #include [trusted]