Skip to content

Commit

Permalink
hid_close will close immediately on win32
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LianYangCn authored Jul 12, 2019
1 parent 5447bde commit e739dc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions windows/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e739dc1

Please sign in to comment.