On Tue, Aug 19, 2014 at 06:06:22PM +0200, Timm Bäder wrote: > --- > libvirt-gobject/libvirt-gobject-domain-snapshot.c | 59 +++++++++++++++++++++++ > libvirt-gobject/libvirt-gobject-domain-snapshot.h | 11 +++++ > libvirt-gobject/libvirt-gobject.sym | 2 + > 3 files changed, 72 insertions(+) > > diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c > index b071c5b..0dcbecc 100644 > --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c > +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c > @@ -304,6 +304,65 @@ gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot, > return TRUE; > } > > +static void _revert_to_async_thread(GTask *task, > + gpointer source_object, > + gpointer task_data, > + GCancellable *cancellable) { > + GError *error = NULL; > + gboolean status; > + > + status = gvir_domain_snapshot_revert_to(source_object, > + GPOINTER_TO_UINT(task_data), > + cancellable, > + &error); > + > + if (status) > + g_task_return_boolean(task, TRUE); > + else > + g_task_return_error(task, error); > +} > + > + > +/** > + * gvir_domain_snapshot_revert_to_async: > + * @snapshot: A #GVirDomainSnapshot > + * @cancellable: (allow-none) (transfer none): cancellation object > + * @callback: (scope async): The callback > + * @user_data: (closure): Opaque data for callback > + */ > +void gvir_domain_snapshot_revert_to_async(GVirDomainSnapshot *snapshot, > + guint flags, > + GCancellable *cancellable, > + GAsyncReadyCallback callback, > + gpointer user_data) { > + GTask *task; > + > + g_return_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot)); > + > + task = g_task_new(snapshot, cancellable, callback, user_data); > + g_task_set_task_data(task, GUINT_TO_POINTER(flags), NULL); > + g_task_run_in_thread(task, _revert_to_async_thread); > + g_object_unref(task); > +} > + > + > + > +/** > + * gvir_domain_snapshot_revert_to_finished: _finish, I'll fix that up before pushing. Christophe
Attachment:
pgpsRwTar8Wnl.pgp
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list