diff --git a/GetRuntimeAddresses/symbolyze/symbolyze.go b/GetRuntimeAddresses/symbolyze/symbolyze.go index d3c9f45..79af466 100644 --- a/GetRuntimeAddresses/symbolyze/symbolyze.go +++ b/GetRuntimeAddresses/symbolyze/symbolyze.go @@ -9,6 +9,7 @@ import ( "path/filepath" "strconv" "strings" + "sync" ) // Scanner represents an engine for scanning for a specific symbol in all @@ -122,6 +123,7 @@ func (S *Scanner) Run() error { proc.Close() + var wg sync.WaitGroup for _, pinfo := range infos { var pid_s = pinfo.Name() @@ -135,18 +137,20 @@ func (S *Scanner) Run() error { } else { // Notify the observers. for n, observer := range S.observers { + wg.Add(1) go func() { err = observer(pid, offset) if err != nil { S.setErrorf("S.observer[%d] error: %v", n, err) // TODO: propagate errors from all Observers. } - + wg.Done() }() } } } + wg.Wait() return S.err }