qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V19 08/10] libqblock: libqblock API implement


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V19 08/10] libqblock: libqblock API implement
Date: Thu, 21 Feb 2013 14:41:58 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Feb 16, 2013 at 10:48:15AM +0800, Wenchao Xia wrote:
> +static int create_context(QBlockContext **p_context)
> +{
> +    /*
> +     * library init comes here, to make sure block_init is called before with
> +     * flag __attribute__((constructor)).
> +     */
> +    if (pthread_mutex_lock(&libqb_global_data.mutex)) {
> +        return QB_ERR_FATAL_ERR;
> +    }
> +    if (libqb_global_data.init_flag == 0) {
> +        qemu_init_main_loop();
> +        bdrv_init();
> +        libqb_global_data.init_flag = 1;
> +    }
> +    if (pthread_mutex_unlock(&libqb_global_data.mutex)) {
> +        return QB_ERR_FATAL_ERR;
> +    }

http://developer.gnome.org/glib/2.34/glib-Threads.html#g-once



reply via email to

[Prev in Thread] Current Thread [Next in Thread]