1
0
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:
joe-conigliaro
2021-01-20 16:04:59 +11:00
committed by GitHub
parent b3a4f746a2
commit 97ebecc5f4
23 changed files with 261 additions and 119 deletions

View File

@@ -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)