transfered from bitcoin-core/HWI#659
reproducer:
import hid
import threading
def e():
m.acquire()
print(hid.enumerate())
m.release()
m = threading.Lock()
a = threading.Thread(target=e, args=())
b = threading.Thread(target=e, args=())
c = threading.Thread(target=e, args=())
a.start()
b.start()
c.start()
a.join()
b.join()
c.join()