hidclass.sys: Properly quit hid_device_thread when both completion event and halt event are signaled (try 2)

Qian Hong fracting at gmail.com
Thu Jan 7 00:47:50 CST 2016


On Thu, Jan 7, 2016 at 1:23 PM, Sebastian Lackner <sebastian at fds-team.de> wrote:
> Wouldn't it be easier to just swap events[0] <-> events[1], to handle the
> exit event with higher priority? I do not see any real need for two calls
> to Wait*() functions.


After discussing on irc, we agree that swapping  events[0] <->
events[1] is not enough.
The original patch fix not only one bug, but two separate problems.
In the existent implementation, If ntrc is never set to
STATUS_PENDING, then there is no chance to turn exit_now to true,
Changhui's patch fix this bug, which is discovered by a real world
online bank driver.

Sebastian also pointed out another bug in the existent implementation:
halt_event is created as an auto-reset event, which means the
first wait*() call could reset it. The correct solution is creating
halt_event as manual-reset event instead.
It might make sense to create events[0] as manual-reset as well, which
makes the following ResetEvent() calls more reasonable.






-- 
Regards,
Qian Hong

-
http://www.winehq.org



More information about the wine-devel mailing list