Paolo Bonzini c7c4d063f5 qemu-thread: add QemuEvent
This emulates Win32 manual-reset events using futexes or conditional
variables.  Typical ways to use them are with multi-producer,
single-consumer data structures, to test for a complex condition whose
elements come from different threads:

    for (;;) {
        qemu_event_reset(ev);
        ... test complex condition ...
        if (condition is true) {
            break;
        }
        qemu_event_wait(ev);
    }

Or more efficiently (but with some duplication):

    ... evaluate condition ...
    while (!condition) {
        qemu_event_reset(ev);
        ... evaluate condition ...
        if (!condition) {
            qemu_event_wait(ev);
            ... evaluate condition ...
        }
    }

QemuEvent provides a very fast userspace path in the common case when
no other thread is waiting, or the event is not changing state.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-10-17 17:30:55 +02:00
..
2013-07-27 11:22:53 +04:00
2013-10-17 17:24:14 +02:00
2013-03-01 13:53:10 +01:00
2013-02-16 11:11:34 +00:00
2013-07-10 13:42:09 -04:00
2013-10-17 17:30:55 +02:00
2013-10-17 17:30:55 +02:00
2013-04-13 19:39:59 +00:00