[Top][All Lists]
[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
- Re: [Qemu-devel] [PATCH 1/6] libqblock APIs, (continued)
Re: [Qemu-devel] [PATCH 1/6] libqblock APIs, Eric Blake, 2012/09/03
Re: [Qemu-devel] [PATCH 1/6] libqblock APIs, Wenchao Xia, 2012/09/04
Re: [Qemu-devel] [PATCH 1/6] libqblock APIs, Eric Blake, 2012/09/04
Re: [Qemu-devel] [PATCH 1/6] libqblock APIs,
Paolo Bonzini <=
Re: [Qemu-devel] [PATCH 1/6] libqblock APIs, Blue Swirl, 2012/09/03
[Qemu-devel] [PATCH 3/6] libqblock error handling, Wenchao Xia, 2012/09/03
[Qemu-devel] [PATCH 5/6] libqblock test example, Wenchao Xia, 2012/09/03
[Qemu-devel] [PATCH 4/6] libqblock internal used functions, Wenchao Xia, 2012/09/03