mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
refactor and to go mod
This commit is contained in:
17
server/utils/prallel.go
Normal file
17
server/utils/prallel.go
Normal file
@@ -0,0 +1,17 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user