[Spice-devel] [PATCH v7 06/14] usbredir: Spawn a different thread for device redirection flow

Christophe Fergeau cfergeau at redhat.com
Wed Mar 16 10:27:28 UTC 2016


Hey,

On Tue, Mar 15, 2016 at 02:31:03PM -0500, Jonathon Jongsma wrote:
> +#ifndef USE_POLKIT
> +static void
> +_open_device_async_cb(GTask *task,
> +                      gpointer object,
> +                      gpointer task_data,
> +                      GCancellable *cancellable)
> +{
> +    GError *err = NULL;
> +    SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(object);
> +    SpiceUsbredirChannelPrivate *priv = channel->priv;
> +
> +    spice_usbredir_channel_lock(channel);
> +
> +    if (!spice_usbredir_channel_open_device(channel, &err)) {
> +        g_task_return_error(task, err);
> +        libusb_unref_device(priv->device);
> +        priv->device = NULL;
> +        g_boxed_free(spice_usb_device_get_type(), priv->spice_device);
> +        priv->spice_device = NULL;
> +    }
> +
> +    spice_usbredir_channel_unlock(channel);
> +}
> +#endif
> +
>  G_GNUC_INTERNAL
>  void spice_usbredir_channel_connect_device_async(
>                                            SpiceUsbredirChannel *channel,
> @@ -331,9 +356,6 @@ void spice_usbredir_channel_connect_device_async(
>  {
>      SpiceUsbredirChannelPrivate *priv = channel->priv;
>      GTask *task;
> -#ifndef USE_POLKIT
> -    GError *err = NULL;
> -#endif
>  
>      g_return_if_fail(SPICE_IS_USBREDIR_CHANNEL(channel));
>      g_return_if_fail(device != NULL);
> @@ -376,15 +398,7 @@ void spice_usbredir_channel_connect_device_async(
>                                          channel);
>      return;
>  #else
> -    if (!spice_usbredir_channel_open_device(channel, &err)) {
> -        g_task_return_error(task, err);
> -        libusb_unref_device(priv->device);
> -        priv->device = NULL;
> -        g_boxed_free(spice_usb_device_get_type(), priv->spice_device);
> -        priv->spice_device = NULL;
> -    } else {
> -        g_task_return_boolean(task, TRUE);

Only looked at the diff, not at the full code, but this
g_task_return_boolean(task, TRUE); is gone from the threaded version, is
this intentional?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160316/6fe6f1ce/attachment.sig>


More information about the Spice-devel mailing list