summaryrefslogtreecommitdiff
path: root/util/qemu-thread-posix.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-11qemu-thread-posix: Fix build against older glibc versionJan Kiszka1-1/+1
pthread_setname_np was introduced with 2.12. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-09Add a 'name' parameter to qemu_thread_createDr. David Alan Gilbert1-2/+7
If enabled, set the thread name at creation (on GNU systems with pthread_set_np) Fix up all the callers with a thread name Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2014-03-09Add 'debug-threads' suboption to --nameDr. David Alan Gilbert1-0/+7
Add flag storage to qemu-thread-* to store the namethreads flag Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2013-10-17qemu-thread: add QemuEventPaolo Bonzini1-0/+116
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-08-05semaphore: fix a hangup problem under load on NetBSD hosts.Izumi Tsutsui1-12/+16
Fix following bugs in "fallback implementation of counting semaphores with mutex+condvar" added in c166cb72f1676855816340666c3b618beef4b976: - waiting threads are not restarted properly if more than one threads are waiting unblock signals in qemu_sem_timedwait() - possible missing pthread_cond_signal(3) calls when waiting threads are returned by ETIMEDOUT - fix an uninitialized variable The problem is analyzed by and fix is provided by Noriyuki Soda. Also put additional cleanup suggested by Laszlo Ersek: - make QemuSemaphore.count unsigned (it won't be negative) - check a return value of in pthread_cond_wait() in qemu_sem_wait() Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1372841894-10634-1-git-send-email-tsutsui@ceres.dti.ne.jp Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-12build: move libqemuutil.a components to util/Paolo Bonzini1-0/+327
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>