forked from bearsh/hid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hid_test.go
28 lines (24 loc) · 630 Bytes
/
hid_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// hid - Gopher Interface Devices (USB HID)
// Copyright (c) 2017 Péter Szilágyi. All rights reserved.
//
// This file is released under the 3-clause BSD license. Note however that Linux
// support depends on libusb, released under GNU LGPL 2.1 or later.
package hid
import (
"sync"
"testing"
)
// Tests that device enumeration can be called concurrently from multiple threads.
func TestThreadedEnumerate(t *testing.T) {
var pend sync.WaitGroup
for i := 0; i < 8; i++ {
pend.Add(1)
go func(index int) {
defer pend.Done()
for j := 0; j < 512; j++ {
Enumerate(uint16(index), 0)
}
}(i)
}
pend.Wait()
}