Skip to content

Commit

Permalink
Merge pull request #129 from ruudk/patch-1
Browse files Browse the repository at this point in the history
StopAllProcesses in parallel
  • Loading branch information
ochinchina authored Feb 8, 2019
2 parents 7bdcbab + b1a2eb2 commit ef69f1b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion process/process_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,19 @@ func (pm *ProcessManager) getAllProcess() []*Process {
}

func (pm *ProcessManager) StopAllProcesses() {
var wg sync.WaitGroup

pm.ForEachProcess(func(proc *Process) {
proc.Stop(true)
wg.Add(1)

go func(wg *sync.WaitGroup) {
defer wg.Done()

proc.Stop(true)
}(&wg)
})

wg.Wait()
}

func sortProcess(procs []*Process) []*Process {
Expand Down

0 comments on commit ef69f1b

Please sign in to comment.