Re: [PATCH 01/14] channel-base: Use GTask instead of GSimpleAsyncResult

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 18, 2016 at 10:05:37AM +0100, Fabiano Fidêncio wrote:
> Instead of using GSimpleAsyncResult, use the new GTask API, which is
> much more straightforward.
> For using the new GTask API, let's bump GIO (part of GLib) dependency
> version to 2.36, which is safe based on major distro support:
> - Debian Jessie: glib-2.42
> - RHEL-7.1: glib-2.40
> - SLES12: glib-2.38
> - Ubuntu LTS 14.04: glib-2.40
> ---
>  configure.ac       |  6 +++---
>  src/channel-base.c | 26 ++++++++++----------------
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 38db8b5..e113487 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -201,7 +201,7 @@ fi
>  
>  AC_CHECK_FUNCS(clearenv strtok_r)
>  
> -PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.28)
> +PKG_CHECK_MODULES(GLIB2, glib-2.0)
>  AC_SUBST(GLIB2_CFLAGS)
>  AC_SUBST(GLIB2_LIBS)
>  
> @@ -209,7 +209,7 @@ PKG_CHECK_MODULES(GOBJECT2, gobject-2.0)
>  AC_SUBST(GOBJECT2_CFLAGS)
>  AC_SUBST(GOBJECT2_LIBS)
>  
> -PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.10.0 $gio_os)
> +PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.36 $gio_os)
>  AC_SUBST(GIO_CFLAGS)
>  AC_SUBST(GIO_LIBS)
>  
> @@ -217,7 +217,7 @@ PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0)
>  AC_SUBST(CAIRO_CFLAGS)
>  AC_SUBST(CAIRO_LIBS)
>  
> -PKG_CHECK_MODULES(GTHREAD, gthread-2.0 > 2.0.0)
> +PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
>  AC_SUBST(GTHREAD_CFLAGS)
>  AC_SUBST(GTHREAD_LIBS)
>  
> diff --git a/src/channel-base.c b/src/channel-base.c
> index 13e4ced..517e7b2 100644
> --- a/src/channel-base.c
> +++ b/src/channel-base.c
> @@ -240,10 +240,9 @@ void spice_channel_set_handlers(SpiceChannelClass *klass,
>  static void
>  vmc_write_free_cb(uint8_t *data, void *user_data)
>  {
> -    GSimpleAsyncResult *result = user_data;
> +    GTask *task = user_data;
>  
> -    g_simple_async_result_complete_in_idle(result);

The callback for the async call was called after vmc_write_free_cb()
runs (ie after the message has been sent in spice_channel_write_msg)...

> -    g_object_unref(result);
> +    g_object_unref(task);
>  }
>  
>  G_GNUC_INTERNAL
> @@ -254,15 +253,14 @@ void spice_vmc_write_async(SpiceChannel *self,
>                             gpointer user_data)
>  {
>      SpiceMsgOut *msg;
> -    GSimpleAsyncResult *simple;
> +    GTask *task;
>  
> -    simple = g_simple_async_result_new(G_OBJECT(self), callback, user_data,
> -                                       spice_port_write_async);
> -    g_simple_async_result_set_op_res_gssize(simple, count);
> +    task = g_task_new(self, cancellable, callback, user_data);
> +    g_task_return_int(task, count);

... but with this call here, I suspect the ordering of the async
callback being called, and spice_channel_write_msg() being called become
unspecified.
Have you checked that it's actually a non-issue? If yes, this would
deserve detailed explanations in the commit log.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]