Re: [RFC PATCH] initialize global images at load time

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

 



Hi,

On Fri, Feb 26, 2016 at 10:37:21AM +0000, Frediano Ziglio wrote:
> This make sure these stuff are initialized without using runtime
> resources.
> Also make sure stuff are initialize really earlier.
>
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/red-dispatcher.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
> index c2ca6b6..d09d56d 100644
> --- a/server/red-dispatcher.c
> +++ b/server/red-dispatcher.c
> @@ -902,6 +902,12 @@ void red_dispatcher_async_complete(struct RedDispatcher *dispatcher,
>      free(async_command);
>  }
>
> +static void __attribute__((constructor)) red_dispatcher_global_init(void)
> +{
> +    quic_init();
> +    sw_canvas_init();
> +}

We could have a define for it in spice-common and use it in a few more
places I think. Also, it seems to be gcc specific so a #define could
help dealing with other compilers.


Cheers,
  toso

> +
>  void red_dispatcher_init(QXLInstance *qxl)
>  {
>      RedDispatcher *red_dispatcher;
> @@ -911,13 +917,6 @@ void red_dispatcher_init(QXLInstance *qxl)
>      spice_return_if_fail(qxl != NULL);
>      spice_return_if_fail(qxl->st->dispatcher == NULL);
>  
> -    static gsize initialized = FALSE;
> -    if (g_once_init_enter(&initialized)) {
> -        quic_init();
> -        sw_canvas_init();
> -        g_once_init_leave(&initialized, TRUE);
> -    }
> -
>      red_dispatcher = spice_new0(RedDispatcher, 1);
>      red_dispatcher->qxl = qxl;
>      dispatcher_init(&red_dispatcher->dispatcher, RED_WORKER_MESSAGE_COUNT, NULL);
> -- 
> 2.5.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
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]