Re: Crash in reads with short timeout - race.

Travis <[email protected]> Fri, 13 Apr 2018 12:14:24 -0600
Newsgroups gmane.comp.lib.libusb.devel.windows
Message-ID <[email protected]>
Greetings,

Let's check the return code.  What about this:
static int _usb_cancel_io(usb_context_t *context)
{
     int ret;
     ret = _usb_abort_ep(context->dev, context->req.endpoint.endpoint);
     if (ret == 0)
     {
         WaitForSingleObject(context->ol.hEvent, 1000);
     }
     else
     {
         WaitForSingleObject(context->ol.hEvent, 0);
     }
     return ret;
}

Use 1000 ms I think.  That should always be plenty and it will keep it 
from dead locking.

Regards,
Travis

On 4/12/2018 5:14 PM, Peter Dons Tychsen via Libusb-win32-devel wrote:
> Hi Xiaofan,
>
>> Thanks a lot for your detailed information. I will see if Travis
>> still monitors
>> this mailing list and can comment on this fix.
> It would be great if Travis (or someone else) could verify and apply
> the fix.
>
>> The good thing is that it only touches the library (DLL) part and not
>> the driver part (which requires digital signature).
> Yup. Signing is a pain. Especially for people that do not have a valid
> cert to sign with.
>
>> I think CancellIOEx() is available since Vista. But it does not
>> matter
>> if you still need XP.
> Yep, my bad. Only XP/2003 does not have it. Still cannot use it
> however, for that reason.
>
> Thanks,
>
> /pedro
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Libusb-win32-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libusb-win32-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel