[Spice-devel] [PATCH 5/8] client: Check for pthread yield function using autoconf
alexl at redhat.com
alexl at redhat.com
Wed Sep 29 04:43:07 PDT 2010
From: Alexander Larsson <alexl at redhat.com>
---
client/x11/platform.cpp | 2 +-
configure.ac | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index cc1502b..a9b4449 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -463,7 +463,7 @@ void Platform::msleep(unsigned int millisec)
void Platform::yield()
{
- pthread_yield();
+ POSIX_YIELD_FUNC;
}
void Platform::term_printf(const char* format, ...)
diff --git a/configure.ac b/configure.ac
index 3369dde..76f9071 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,6 +128,26 @@ AC_SUBST(LIBRT)
SPICE_NONPKGCONFIG_LIBS+=" -pthread $LIBM $LIBRT"
+dnl The client needs a yield function
+AC_MSG_CHECKING(for posix yield function)
+for yield_func in pthread_yield pthread_yield_np sched_yield \
+ thr_yield; do
+ spice_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $SPICE_NONPKGCONFIG_LIBS"
+ AC_TRY_LINK([#include <pthread.h>],
+ [$yield_func()],
+ [posix_yield_func="$yield_func"
+ break])
+ CPPFLAGS="spice_save_CPPFLAGS"
+done
+if test x"$posix_yield_func" = xnone; then
+ AC_MSG_ERROR([No posix yield function found])
+else
+ AC_MSG_RESULT($posix_yield_func)
+ posix_yield_func="$posix_yield_func()"
+fi
+AC_DEFINE_UNQUOTED(POSIX_YIELD_FUNC,$posix_yield_func,[The POSIX RT yield function])
+
SPICE_REQUIRES=""
if test "x$use_gui" = "xyes"; then
--
1.7.0.1
More information about the Spice-devel
mailing list