From e739dc117c575cfc8246a7056a0c321e81142ab0 Mon Sep 17 00:00:00 2001 From: Lian Yang Date: Fri, 12 Jul 2019 15:05:13 +0800 Subject: [PATCH] hid_close will close immediately on win32 see signal11/hidapi#416 In multi-thread environment, if the hid_read thread is different from the hid_close thread, the hid_read function will block the thread exiting, at the wait object operation. This fix just set the event, after cancel io, so that, hid_read not wait anymore and exiting read --- windows/hid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/hid.c b/windows/hid.c index 4a71e2552..5a22d9d2c 100755 --- a/windows/hid.c +++ b/windows/hid.c @@ -823,6 +823,7 @@ void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev) if (!dev) return; CancelIo(dev->device_handle); + SetEvent(dev->ol.hEvent); free_hid_device(dev); }