[libvirt] [PATCH 01/10] util: Introduce thread queues

Peter Krempa pkrempa at redhat.com
Fri May 22 11:54:55 UTC 2015


On Fri, May 22, 2015 at 00:42:34 +0200, Jiri Denemark wrote:
> Our usage of pthread conditions does not allow a single thread to wait
> for several events from different sources. This is because the condition
> is bound to the source of the event. We can invert the usage by giving
> each thread its own condition and providing APIs for registering this
> thread condition with several sources. Each of the sources can then
> signal the thread condition.
> 
> Thread queues also support several threads to be registered with a
> single event source, which can either wakeup all waiting threads or just
> the first one.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  po/POTFILES.in            |   1 +
>  src/Makefile.am           |   2 +
>  src/libvirt_private.syms  |  15 ++
>  src/util/virthreadqueue.c | 343 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/virthreadqueue.h |  54 ++++++++
>  5 files changed, 415 insertions(+)
>  create mode 100644 src/util/virthreadqueue.c
>  create mode 100644 src/util/virthreadqueue.h
> 

ACK, I don't see anything wrong with this but let's see how it's used.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150522/432278d8/attachment-0001.sig>


More information about the libvir-list mailing list