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

sync/channels: fix bug that caused 100% CPU on block (#6357)

This commit is contained in:
Uwe Krüger
2020-09-13 15:13:06 +02:00
committed by GitHub
parent fc88f43e50
commit 168daebccf
2 changed files with 3 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ pub fn new_channel<T>(n u32) &Channel {
fn new_channel_st(n u32, st u32) &Channel {
return &Channel{
writesem: new_semaphore_init(if n > 0 { n + 1 } else { 1 })
writesem: new_semaphore_init(if n > 0 { n } else { 1 })
readsem: new_semaphore_init(if n > 0 { u32(0) } else { 1 })
writesem_im: new_semaphore()
readsem_im: new_semaphore()