Re: [spice-gtk v2] Introduce gtask-helper.[ch]

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

 



On 23/03/16 09:04, Fabiano Fidêncio wrote:
> gtask-helper provide methods that can easily be used for returning in
> idle, as a few issues have been found in the GTask code used in
> spice-gtk due to a immediately return when a return in idle was
> expected. As examples of these issues, you can take a look on commits
> 7774b8c and e81d97c.
> 
> Not all the functions introduced in gtask-helper.h are being used, but I
> still decided to add them for completeness reasons.
> 
> Also, all the functions called in idle are the same that were being
> called in idle when using GSimpleAsyncResult. So, no issues should be
> found after this change and no behavior change should noticed.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>

[snip]
> +++ b/src/gtask-helper.c
> @@ -0,0 +1,153 @@
> +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> +/*
> +   Copyright (C) 2016 Red Hat, Inc.
> +
> +   This library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.0 of the License, or (at your option) any later version.
> +
> +   This library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with this library; if not, write to the Free Software
> +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
> +*/
> +#include "config.h"
> +
> +#include "gtask-helper.h"
> +
> +typedef struct _GTaskHelperData
> +{
> +    GTask *task;
> +    GError *error;
> +    gint integer;
> +    gboolean boolean;
> +    gpointer pointer;
> +    GDestroyNotify destroy_notify_cb;
> +} GTaskHelperData;
> +

So, as far as I understand, you are trying to unify the behavior with
this data structure, but you are wasting quite a lot of memory here. I
don't know how memory critical this is, but, what do you think about
using a union and put all different data types inside of it instead?
That would also require you to declare a new struct for storing pointer
and destroy_notify_cb.

Just $0.02.

Regards, Etrunko

-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko@xxxxxxxxxx
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]