mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
usecache: get all tests running with -usecache enabled by default (p.1) (#7699)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module atomic2
|
||||
|
||||
import sync
|
||||
|
||||
/*
|
||||
Implements the atomic operations. For now TCC does not support
|
||||
the atomic versions on nix so it uses locks to simulate the same behavor.
|
||||
@@ -16,16 +18,13 @@ further tested.
|
||||
#flag darwin -I @VROOT/thirdparty/stdatomic/nix
|
||||
#flag freebsd -I @VROOT/thirdparty/stdatomic/nix
|
||||
#flag solaris -I @VROOT/thirdparty/stdatomic/nix
|
||||
|
||||
$if linux {
|
||||
$if tinyc {
|
||||
// most Linux distributions have /usr/lib/libatomic.so, but Ubuntu uses gcc version specific dir
|
||||
#flag -L/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/9 -latomic
|
||||
}
|
||||
}
|
||||
|
||||
#include <atomic.h>
|
||||
|
||||
// add_u64 adds provided delta as an atomic operation
|
||||
pub fn add_u64(ptr &u64, delta int) bool {
|
||||
res := C.atomic_fetch_add_u64(ptr, delta)
|
||||
@@ -51,7 +50,6 @@ pub fn sub_i64(ptr &i64, delta int) bool {
|
||||
}
|
||||
|
||||
// atomic store/load operations have to be used when there might be another concurrent access
|
||||
|
||||
// atomicall set a value
|
||||
pub fn store_u64(ptr &u64, val u64) {
|
||||
C.atomic_store_u64(ptr, val)
|
||||
|
||||
Reference in New Issue
Block a user