mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
0a8d2d5dc7
commit
b907cf2179
@ -67,7 +67,7 @@ fn main() {
|
|||||||
|
|
||||||
wg := sync.new_waitgroup()
|
wg := sync.new_waitgroup()
|
||||||
mtx := sync.new_mutex()
|
mtx := sync.new_mutex()
|
||||||
mut fetcher := &Fetcher{ids: ids}
|
mut fetcher := &Fetcher{ids: ids mu: 0 wg: 0}
|
||||||
fetcher.mu = &mtx
|
fetcher.mu = &mtx
|
||||||
fetcher.wg = &wg
|
fetcher.wg = &wg
|
||||||
fetcher.wg.add(ids.len)
|
fetcher.wg.add(ids.len)
|
||||||
|
@ -32,7 +32,12 @@ pub fn (wg mut WaitGroup) done() {
|
|||||||
|
|
||||||
pub fn (wg mut WaitGroup) wait() {
|
pub fn (wg mut WaitGroup) wait() {
|
||||||
for wg.active > 0 {
|
for wg.active > 0 {
|
||||||
// waiting
|
// Do not remove this, busy empty loops are optimized
|
||||||
|
// with -prod by some compilers, see issue #2874
|
||||||
|
$if windows {
|
||||||
|
C.Sleep(1)
|
||||||
|
} $else {
|
||||||
|
C.usleep(1000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user