From 401bc051d7706e33046d79539465b8326383a1b2 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 5 Sep 2017 13:19:32 +0100 Subject: util/qemu-thread-posix.c: Replace OS ifdefs with CONFIG_HAVE_SEM_TIMEDWAIT In qemu-thread-posix.c we have two implementations of the various qemu_sem_* functions, one of which uses native POSIX sem_* and the other of which emulates them with pthread conditions. This is necessary because not all our host OSes support sem_timedwait(). Instead of a hard-coded list of OSes which don't implement sem_timedwait(), which gets out of date, make configure test for the presence of the function and set a new CONFIG_HAVE_SEM_TIMEDWAIT appropriately. In particular, newer NetBSDs have sem_timedwait(), so this commit will switch them over to using it. OSX still does not have an implementation. Signed-off-by: Peter Maydell Reviewed-by: Kamil Rytarowski Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- include/qemu/thread-posix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/qemu/thread-posix.h') diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index e5e3a0f..f4296d3 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -21,7 +21,7 @@ struct QemuCond { }; struct QemuSemaphore { -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_t lock; pthread_cond_t cond; unsigned int count; -- cgit v1.1