qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/6] libqblock APIs


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/6] libqblock APIs
Date: Tue, 04 Sep 2012 15:47:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

Il 04/09/2012 13:35, Eric Blake ha scritto:
>> >   No, it should be only called once, any other thread should not call
>> > it again, will document it. About the multiple thread user case, qemu
>> > block layer can't support that now, will fix that later.
> What a shame.  That makes libraries much harder to use.  It is much
> nicer to design a library where the initialization is idempotent and
> thread-safe, to be called from multiple threads.  Consider:
> 
> app links against liba and libb;
> liba links against libqb
> libb links against libqb
> 
> How am I supposed to write liba and libb to guarantee only one single
> race-free call to libqblock_init, unless libqblock_init() is idempotent?

I agree, libqblock_init should use pthread_once (or we can add QemuOnce
to qemu-thread-*.c).

Paolo



reply via email to

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