On Wed, Sep 12, 2012 at 4:50 PM, John Chen <john...@gmail.com> wrote:

> Oops! I was not understand " running multiple simultaneous event loops"
> right, I thought in multi-threading app, of course you are running event
> multiple time.
>
> Anyway, I created a new thread and it sees to fix the problem, but now I
> am having a performance issue, in the new thread , I have
> while (continue)
> {
>  err = libusb_handle_events_timeout_completed(NULL, &tv,&completed );
>   Sleep(100)
> }
>
> Also, in the BulkRead Thread, I have
>  while (!userdata->ExitTransfer)
> {
> cout << "Bulk Write waiting the call back............" << std::endl;
>  Sleep(100);
> }
>
> So I will lost 200 ms or whatever time I need to wait, anyway around this?
>
>
You don't need to have those Sleep calls. Your callback shouldn't have any
waiting. And the event loop shouldn't have any either. If there are no
pending events, the call to libusb_handle_events_timeout_completed will
timeout and your loop will start over again.

David
------------------------------------------------------------------------------
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