mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-11 19:29:20 +08:00
Merge pull request #476 from muehlburger/master
Refactor TestAdaptorDigitalPinConcurrency test
This commit is contained in:
commit
30b0eb9576
@ -210,14 +210,14 @@ func TestAdaptorDigitalPinConcurrency(t *testing.T) {
|
||||
|
||||
a := initTestAdaptor()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(20)
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
wg.Add(1)
|
||||
pinAsString := strconv.Itoa(i)
|
||||
go func() {
|
||||
go func(pin string) {
|
||||
defer wg.Done()
|
||||
a.DigitalPin(pinAsString, sysfs.IN)
|
||||
}()
|
||||
a.DigitalPin(pin, sysfs.IN)
|
||||
}(pinAsString)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
Loading…
x
Reference in New Issue
Block a user