Despite the name implying it's a standard part of the POSIX threads API, pthread_yield is actually non-standard and not entirely portable. For systems like Solaris that don't have it, fall back to sched_yield.
Signed-off-by: Alan Coopersmith <[email protected]> --- configure.ac | 1 + tests/gem_fence_thrash.c | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 197c622..5fe993c 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE # Checks for functions, headers, structures, etc. +AC_CHECK_FUNCS([pthread_yield]) AC_CHECK_HEADERS([termios.h]) AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT #include <sys/sysinfo.h> diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index 8ed4e08..22c1e4b 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -26,6 +26,8 @@ * */ +#include "config.h" + #define _GNU_SOURCE #include <unistd.h> @@ -110,7 +112,11 @@ bo_copy (void *_arg) for (n = 0; n < 1000; n++) { memcpy (a, b, OBJECT_SIZE); +#ifdef HAVE_PTHREAD_YIELD pthread_yield (); +#else + sched_yield (); +#endif } return NULL; -- 1.7.3.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
