mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-14 19:29:32 +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()
|
a := initTestAdaptor()
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(20)
|
|
||||||
|
|
||||||
for i := 0; i < 20; i++ {
|
for i := 0; i < 20; i++ {
|
||||||
|
wg.Add(1)
|
||||||
pinAsString := strconv.Itoa(i)
|
pinAsString := strconv.Itoa(i)
|
||||||
go func() {
|
go func(pin string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
a.DigitalPin(pinAsString, sysfs.IN)
|
a.DigitalPin(pin, sysfs.IN)
|
||||||
}()
|
}(pinAsString)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user