1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v: deprecate @VROOT in favour of @VMODROOT (#9795)

This commit is contained in:
Delyan Angelov
2021-04-19 19:01:47 +03:00
committed by GitHub
parent 4b230d16b3
commit d4f31412b7
41 changed files with 194 additions and 109 deletions

View File

@ -5,17 +5,17 @@ Implements the atomic operations. For now TCC does not support
the atomic versions on nix so it uses locks to simulate the same behavor.
On windows tcc can simulate with other atomic operations.
The @VROOT/thirdparty/stdatomic contains compability header files
The @VEXEROOT/thirdparty/stdatomic contains compability header files
for stdatomic that supports both nix, windows and c++.
This implementations should be regarded as alpha stage and be
further tested.
*/
#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
#flag windows -I @VEXEROOT/thirdparty/stdatomic/win
#flag linux -I @VEXEROOT/thirdparty/stdatomic/nix
#flag darwin -I @VEXEROOT/thirdparty/stdatomic/nix
#flag freebsd -I @VEXEROOT/thirdparty/stdatomic/nix
#flag solaris -I @VEXEROOT/thirdparty/stdatomic/nix
$if linux {
$if tinyc {
// most Linux distributions have /usr/lib/libatomic.so, but Ubuntu uses gcc version specific dir

View File

@ -3,11 +3,10 @@ module sync
import time
import rand
$if windows {
#flag -I @VROOT/thirdparty/stdatomic/win
#flag -I @VEXEROOT/thirdparty/stdatomic/win
} $else {
#flag -I @VROOT/thirdparty/stdatomic/nix
#flag -I @VEXEROOT/thirdparty/stdatomic/nix
}
$if linux {
@ -198,7 +197,7 @@ fn (mut ch Channel) try_push_priv(src voidptr, no_block bool) ChanState {
if C.atomic_load_u16(&ch.closed) != 0 {
return .closed
}
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { spinloops, spinloops_sem }
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { sync.spinloops, sync.spinloops_sem }
mut have_swapped := false
for {
mut got_sem := false
@ -387,7 +386,7 @@ pub fn (mut ch Channel) try_pop(dest voidptr) ChanState {
}
fn (mut ch Channel) try_pop_priv(dest voidptr, no_block bool) ChanState {
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { spinloops, spinloops_sem }
spinloops_sem_, spinloops_ := if no_block { 1, 1 } else { sync.spinloops, sync.spinloops_sem }
mut have_swapped := false
mut write_in_progress := false
for {