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(a)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