From: Ken Raeburn Date: Sat, 7 Aug 2004 15:52:52 +0000 (+0000) Subject: * configure.in: Look for sched.h and sched_yield. X-Git-Tag: krb5-1.4-beta1~163 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=952ae42cdb5120d7b9410edc4f46f2e624176df4;p=krb5.git * configure.in: Look for sched.h and sched_yield. * k5-thread.h: Only include sched.h if it's available. (MAYBE_SCHED_YIELD): Only use sched_yield if sched.h and sched_yield are available; if weak references are supported and sched_yield isn't available by default, check for it at run time. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16645 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 74894bb21..ed7a97f91 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,11 @@ +2004-08-07 Ken Raeburn + + * configure.in: Look for sched.h and sched_yield. + * k5-thread.h: Only include sched.h if it's available. + (MAYBE_SCHED_YIELD): Only use sched_yield if sched.h and + sched_yield are available; if weak references are supported and + sched_yield isn't available by default, check for it at run time. + 2004-08-05 Ken Raeburn * k5-thread.h [HAVE_PTHREAD]: Include sched.h if diff --git a/src/include/configure.in b/src/include/configure.in index 8f6999dbd..ea81a880f 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -9,10 +9,10 @@ AC_PROG_INSTALL AC_PROG_AWK AC_PROG_LEX AC_C_CONST -AC_CHECK_FUNCS(strdup setvbuf inet_ntoa inet_aton seteuid setresuid setreuid setegid setresgid setregid setsid flock fchmod chmod strftime strptime geteuid setenv unsetenv getenv gethostbyname2 getifaddrs getpwnam_r getpwuid_r gmtime_r localtime_r pthread_mutex_lock) +AC_CHECK_FUNCS(strdup setvbuf inet_ntoa inet_aton seteuid setresuid setreuid setegid setresgid setregid setsid flock fchmod chmod strftime strptime geteuid setenv unsetenv getenv gethostbyname2 getifaddrs getpwnam_r getpwuid_r gmtime_r localtime_r pthread_mutex_lock sched_yield) AC_CHECK_FUNCS( mkstemp) AC_HEADER_STDARG -AC_CHECK_HEADERS(unistd.h paths.h regex.h regexp.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h) +AC_CHECK_HEADERS(unistd.h paths.h regex.h regexp.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h sched.h) dnl dnl Check what the return types for gethostbyname_r and getservbyname_r are. dnl diff --git a/src/include/k5-thread.h b/src/include/k5-thread.h index f9c39ef37..d693fea79 100644 --- a/src/include/k5-thread.h +++ b/src/include/k5-thread.h @@ -418,9 +418,14 @@ typedef struct { #define k5_pthread_assert_unlocked(M) (0) #define k5_pthread_assert_locked(M) (0) -#ifdef DEBUG_THREADS_SLOW +#if defined(DEBUG_THREADS_SLOW) && HAVE_SCHED_H && (HAVE_SCHED_YIELD || HAVE_PRAGMA_WEAK_REF) # include -# define MAYBE_SCHED_YIELD() ((void)sched_yield()) +# if !HAVE_SCHED_YIELD +# pragma weak sched_yield +# define MAYBE_SCHED_YIELD() ((void)((&sched_yield != NULL) ? sched_yield() : 0)) +# else +# define MAYBE_SCHED_YIELD() ((void)sched_yield()) +# endif #else # define MAYBE_SCHED_YIELD() ((void)0) #endif