Mercurial > hg > octave-shane > gnulib-hg
view m4/fabsl.m4 @ 16869:38e6d30d7e4d
poll/select: prevent busy-waiting
2012-05-21 Paolo Bonzini <bonzini@gnu.org>
poll/select: prevent busy-waiting. SwitchToThread() only gives away
the rest of the current time slice to another thread in the current
process. So if the thread that feeds the file decscriptor we're
polling is not in the current process, we get busy-waiting.
* lib/poll.c: Use SleepEx(1, TRUE) instead of SwitchToThread().
Patch from Theodore Leblond.
* lib/select.c: Split polling out of the loop that sets the output
fd_sets. Check for zero result and loop if the wait timeout is
infinite.
author | Paolo Bonzini <bonzini@gnu.org> |
---|---|
date | Mon, 21 May 2012 09:52:42 +0200 |
parents | fdbe3125f81a |
children | e542fd46ad6f |
line wrap: on
line source
# fabsl.m4 serial 2 dnl Copyright (C) 2011-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FABSL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) dnl Persuade glibc <math.h> to declare fabsl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl Determine FABSL_LIBM. gl_MATHFUNC([fabsl], [long double], [(long double)]) if test $gl_cv_func_fabsl_no_libm = yes \ || test $gl_cv_func_fabsl_in_libm = yes; then save_LIBS="$LIBS" LIBS="$LIBS $FABSL_LIBM" gl_FUNC_FABSL_WORKS LIBS="$save_LIBS" case "$gl_cv_func_fabsl_works" in *yes) ;; *) REPLACE_FABSL=1 ;; esac else HAVE_FABSL=0 fi if test $HAVE_FABSL = 0 || test $REPLACE_FABSL = 1; then dnl Find libraries needed to link lib/fabsl.c. if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then AC_REQUIRE([gl_FUNC_FABS]) FABSL_LIBM="$FABS_LIBM" else FABSL_LIBM= fi fi AC_SUBST([FABSL_LIBM]) ]) dnl Test whether fabsl() works on a minus zero. dnl On IRIX 6.5, with gcc 4.2.4 and without -fno-builtin-fabsl, the value is a dnl minus zero rather than a positive zero. AC_DEFUN([gl_FUNC_FABSL_WORKS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether fabsl works], [gl_cv_func_fabsl_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <float.h> #include <math.h> #include <string.h> volatile long double x; long double y; long double zero = 0.0L; int main () { x = - (LDBL_MIN * LDBL_MIN * LDBL_MIN); y = fabsl (x); return (memcmp (&y, &zero, sizeof y) != 0); } ]])], [gl_cv_func_fabsl_works=yes], [gl_cv_func_fabsl_works=no], [case "$host_os" in irix*) gl_cv_func_fabsl_works="guessing no";; *) gl_cv_func_fabsl_works="guessing yes";; esac ]) ]) ])