mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sync: use asserts in channel code only when -d debug
is passed
This commit is contained in:
parent
a62560d2c1
commit
f1f75897b3
@ -41,7 +41,9 @@ fn main() {
|
||||
go do_rec(ch, resch, n)
|
||||
no -= n
|
||||
}
|
||||
assert no == 0
|
||||
$if debug {
|
||||
assert no == 0
|
||||
}
|
||||
no = nobj
|
||||
for i in 0 .. nsend {
|
||||
n := no / (nsend - i)
|
||||
|
@ -547,8 +547,10 @@ fn (mut ch Channel) try_pop_priv(dest voidptr, no_block bool) ChanState {
|
||||
// -2 if all channels are closed
|
||||
|
||||
pub fn channel_select(mut channels []&Channel, dir []Direction, mut objrefs []voidptr, timeout time.Duration) int {
|
||||
assert channels.len == dir.len
|
||||
assert dir.len == objrefs.len
|
||||
$if debug {
|
||||
assert channels.len == dir.len
|
||||
assert dir.len == objrefs.len
|
||||
}
|
||||
mut subscr := []Subscription{len: channels.len}
|
||||
mut sem := unsafe { Semaphore{} }
|
||||
sem.init(0)
|
||||
|
Loading…
Reference in New Issue
Block a user