synchronize concurrent access to map in test
This commit is contained in:
parent
29be1b5000
commit
509d6e5505
@ -7,6 +7,7 @@ import (
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -35,9 +36,12 @@ func TestSimpleGDB(t *testing.T) {
|
||||
}
|
||||
|
||||
scanner := NewScanner("_PyRuntime", "*python3*")
|
||||
var m sync.Mutex
|
||||
scanner.OnFound(func(pid int, offset uint64) error {
|
||||
t.Logf("scanner setting pid %d to offset %x", pid, offset)
|
||||
m.Lock()
|
||||
ourResults[pid] = offset
|
||||
m.Unlock()
|
||||
return nil
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user