mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
18 lines
226 B
Go
18 lines
226 B
Go
package utils
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
func ParallelFor(begin, end int, fn func(i int)) {
|
|
var wg sync.WaitGroup
|
|
wg.Add(end - begin)
|
|
for i := begin; i < end; i++ {
|
|
go func(i int) {
|
|
fn(i)
|
|
wg.Done()
|
|
}(i)
|
|
}
|
|
wg.Wait()
|
|
}
|