Hi,
I have the following code:
DWORD WINAPI LibUSBDevice::LoopEvent(void* lpParam)
{
while (RunLoopCode)
 {
try
{
 Sleep(100);
struct timeval tv = { 1, 0 };
int completed =0;
 //cout << "before  libusb_handle_events_timeout " << std::endl;
 int err = libusb_handle_events_timeout_completed(NULL, &tv,&completed );
//cout << "after libusb_handle_events_timeout " << std::endl;
 if (err<0)
{
cout << "!!!!!!!!!!!!!!!!!!err calling done
libusb_handle_events_timeout!!!!!!!!!!!!" << std::endl;
 }
}
catch (...)
 {
cout << "!!!!!!!!!!!!unexpected exception!!!!!" << std::endl;
 }

}
return 0;
}

This is in a seperator thread, which is always running, other threads will
call libusb_submit_transfer to submit read and write request simultaneously.

it crash the app, the stack trace are as following:

winusb_abort_transfers+0xf6 [c:\program
files\libusbx-1.0.12\libusb\os\windows_usb.c @ 2863]
windows_abort_transfers+0x41 [c:\program
files\libusbx-1.0.12\libusb\os\windows_usb.c @ 1929]
windows_cancel_transfer+0x51 [c:\program
files\libusbx-1.0.12\libusb\os\windows_usb.c @ 1941]
libusb_cancel_transfer+0x54 [c:\program files\libusbx-1.0.12\libusb\io.c @
1358]
handle_timeout+0x35 [c:\program files\libusbx-1.0.12\libusb\io.c @ 1770]
handle_timeouts_locked+0x110 [c:\program files\libusbx-1.0.12\libusb\io.c @
1814]
handle_timeouts+0x38 [c:\program files\libusbx-1.0.12\libusb\io.c @ 1823]
handle_events+0x258 [c:\program files\libusbx-1.0.12\libusb\io.c @ 1897]
libusb_handle_events_timeout_completed+0x9e [c:\program
files\libusbx-1.0.12\libusb\io.c @ 2029]
LibUSBDevice::LoopEvent+0x62 [c:\USB\usb_io_native\libusbdevice.cpp @ 108]
KERNEL32!BaseThreadInitThunk+0xd
ntdll!RtlUserThreadStart+0x21
Asynchronous device I/O

specifically, the following code:
if (!WinUsb_AbortPipe(winusb_handle, transfer->endpoint)) {
in windows_usb.c crash the app.

strangely enough, the catch (...) does not catch the exception.

Please advice.

Thx
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to