Skip to content
Snippets Groups Projects
Commit 3f2055b1 authored by Changhui Liu's avatar Changhui Liu Committed by Alexandre Julliard
Browse files

hidclass.sys: Properly quit hid_device_thread when both completion event and...

hidclass.sys: Properly quit hid_device_thread when both completion event and halt event are signaled.

Signed-off-by: default avatarChanghui Liu <liuchanghui@linuxdeepin.com>
Signed-off-by: Aric Stewart's avatarAric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard's avatarAlexandre Julliard <julliard@winehq.org>
parent a443318d
No related branches found
No related tags found
No related merge requests found
......@@ -261,7 +261,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
NTSTATUS ntrc;
BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
events[0] = CreateEventA(NULL, FALSE, FALSE, NULL);
events[0] = CreateEventA(NULL, TRUE, FALSE, NULL);
events[1] = ext->halt_event;
if (ext->information.Polled)
......@@ -336,12 +336,13 @@ static DWORD CALLBACK hid_device_thread(void *args)
if (ntrc == STATUS_PENDING)
{
rc = WaitForMultipleObjects(2, events, FALSE, INFINITE);
if (rc == WAIT_OBJECT_0 + 1)
exit_now = TRUE;
WaitForMultipleObjects(2, events, FALSE, INFINITE);
}
rc = WaitForSingleObject(ext->halt_event, 0);
if (rc == WAIT_OBJECT_0)
exit_now = TRUE;
if (!exit_now && irp->IoStatus.u.Status == STATUS_SUCCESS)
{
packet->reportId = buffer[0];
......@@ -368,7 +369,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
void HID_StartDeviceThread(DEVICE_OBJECT *device)
{
BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
ext->halt_event = CreateEventA(NULL, FALSE, FALSE, NULL);
ext->halt_event = CreateEventA(NULL, TRUE, FALSE, NULL);
ext->thread = CreateThread(NULL, 0, hid_device_thread, device, 0, NULL);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment