+1 from me.

-Nathan

On Jul 4, 2013, at 8:55 AM, Hans de Goede <hdego...@redhat.com> wrote:

> Hi All,
> 
> So to make sure the API is sane, and to give the hotplug stuff some extra
> testing, I've ported Spice's usbredir code over to it.
> 
> And everything worked in one go, until I tried to exit the spice client, at
> which point it hangs.
> 
> The problem is that the spice usbredir code uses a thread which does:
> 
>   while(usb_event_thread_run)
>       libusb_handle_events();
> 
> This thread used to get started on the first libusb_open() and stopped like
> this:
> 
>   usb_event_thread_run = 0;
>   libusb_close(handle); /* wakes up libusb_handle_events() */
>   pthread_join(usb_event_thread);
> 
> When closing the last device handle.
> 
> But with libusb handling the hotplug, it is simply always running, until the
> app exits. So now we need a way to wakeup libusb_handle_events() on exit.
> 
> I've considered adding a new libusb API call for this, but in the end I 
> thought
> it made more sense to do the wakeup from libusb_hotplug_deregister_callback(),
> esp. since libusb_hotplug_deregister_callback() depends on 
> libusb_handle_events
> to run atleast once to complete the deregister. So that is what this patch-set
> does.
> 
> So now for an app using hotplug + an event thread, the exit code would look
> something like this:
> 
>   usb_event_thread_run = 0;
>   libusb_hotplug_deregister_callback(ctx, hotplug_cb_handle);
>   pthread_join(usb_event_thread);
>   libusb_exit(ctx);
> 
> Given that without this patch the hotplug API is essentially unusable for
> applications with a separate event thread, I believe we should add this to
> 1.0.16.
> 
> It is not terribly adventurous, but I think it would be best to also do an
> 1.0.16rc3 with this in, and delay the actual release by a few days.
> 
> If I can get an ack for this by tomorrow, I can do 1.0.16rc3 tomorrow, so
> people can test over the weekend.
> 
> Regards,
> 
> Hans
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> libusbx-devel mailing list
> libusbx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusbx-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to