Skip to content

Commit

Permalink
fixed pool - removing redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
olegfomenko committed Nov 11, 2024
1 parent 91de610 commit e30d14b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
16 changes: 2 additions & 14 deletions prover/utils/parallel/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@ var queue chan func() = make(chan func())
var available chan struct{} = make(chan struct{}, runtime.GOMAXPROCS(0))
var once sync.Once

func ExecutePool(task func()) {
once.Do(run)

ch := make(chan struct{}, 1)
queue <- func() {
task()
close(ch)
}

<-ch
}

func ExecutePoolChunky(nbIterations int, work func(k int)) {
once.Do(run)
once.Do(initialize)

wg := sync.WaitGroup{}
wg.Add(nbIterations)
Expand All @@ -39,7 +27,7 @@ func ExecutePoolChunky(nbIterations int, work func(k int)) {
wg.Wait()
}

func run() {
func initialize() {
for i := 0; i < runtime.GOMAXPROCS(0); i++ {
available <- struct{}{}
}
Expand Down
13 changes: 0 additions & 13 deletions prover/utils/parallel/pool/pool_test.go

This file was deleted.

0 comments on commit e30d14b

Please sign in to comment.