[libvirt] [libvirt-glib] [PATCH v5 3/3] GVirDomain: Add async version of _fetch_snapshots

Christophe Fergeau cfergeau at redhat.com
Fri Jul 25 12:58:37 UTC 2014


On Wed, Jul 09, 2014 at 06:23:25PM +0200, Timm Bäder wrote:
> ---
>  libvirt-gobject/libvirt-gobject-domain.c | 61 ++++++++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain.h | 10 ++++++
>  libvirt-gobject/libvirt-gobject.sym      |  2 ++
>  3 files changed, 73 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 8f48c2e..7fd5043 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -1621,3 +1621,64 @@ GList *gvir_domain_get_snapshots(GVirDomain *dom)
>  
>      return snapshots;
>  }
> +
> +
> +
> +static void _fetch_snapshots_async_thread(GTask *task,
> +                                          gpointer source_object,
> +                                          gpointer task_data,
> +                                          GCancellable *cancellable) {
> +    GError *error = NULL;
> +    gboolean status;
> +
> +    status = gvir_domain_fetch_snapshots(source_object,
> +                                         GPOINTER_TO_UINT(task_data),
> +                                         cancellable,
> +                                         &error);
> +    if (status)
> +        g_task_return_boolean(task, TRUE);
> +    else
> +        g_task_return_error(task, error);

This is using GTask without updating the configure.ac glib version check
to 2.36. 
I assume when you use this, valgrind don't complain after you added
the g_object_unref(task) in gvir_domain_fetch_snapshots_async?

Looks good otherwise,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140725/851b63fd/attachment-0001.sig>


More information about the libvir-list mailing list