Skip to content

Commit

Permalink
Fix #803
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime WEYL authored and onsi committed Dec 10, 2024
1 parent 4feb9d7 commit 1c6c112
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gmeasure/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,19 @@ func (e *Experiment) Sample(callback func(idx int), samplingConfig SamplingConfi
minSamplingInterval := samplingConfig.MinSamplingInterval

work := make(chan int)
defer close(work)
var wg sync.WaitGroup
defer func() {
close(work)
wg.Wait()
}()
if numParallel > 1 {
for worker := 0; worker < numParallel; worker++ {
go func() {
wg.Add(1)
for idx := range work {
callback(idx)
}
wg.Done()
}()
}
}
Expand Down

0 comments on commit 1c6c112

Please sign in to comment.