mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sync: don't force Mutex and Semaphore to be reference (#8331)
This commit is contained in:
@@ -10,7 +10,7 @@ fn get_val_from_chan(ch chan i64) ?i64 {
|
||||
}
|
||||
|
||||
// this function gets an array of channels for `i64`
|
||||
fn do_rec_calc_send(chs []chan i64, sem sync.Semaphore) {
|
||||
fn do_rec_calc_send(chs []chan i64, mut sem sync.Semaphore) {
|
||||
mut msg := ''
|
||||
for {
|
||||
mut s := get_val_from_chan(chs[0]) or {
|
||||
@@ -26,8 +26,8 @@ fn do_rec_calc_send(chs []chan i64, sem sync.Semaphore) {
|
||||
|
||||
fn test_channel_array_mut() {
|
||||
mut chs := [chan i64{}, chan i64{cap: 10}]
|
||||
sem := sync.new_semaphore()
|
||||
go do_rec_calc_send(chs, sem)
|
||||
mut sem := sync.new_semaphore()
|
||||
go do_rec_calc_send(chs, mut sem)
|
||||
mut t := i64(100)
|
||||
for _ in 0 .. num_iterations {
|
||||
chs[0] <- t
|
||||
|
||||
Reference in New Issue
Block a user