mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
Replace sched_yield(2) on Linux with select(2) (ITS#3950)
This commit is contained in:
parent
ba8a18a0e4
commit
ed898b28cd
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
||||
OpenLDAP 2.3 Change Log
|
||||
|
||||
OpenLDAP 2.3.16 Engineering
|
||||
Build environment
|
||||
Replace sched_yield(2) on Linux with select(2) (ITS#3950)
|
||||
|
||||
OpenLDAP 2.3.15 Release
|
||||
Fixed slapd strerror logging bug (ITS#4292)
|
||||
|
19
configure
vendored
19
configure
vendored
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.560.2.18 2005/11/26 17:01:54 kurt Exp .
|
||||
# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.560.2.20 2006/01/03 22:16:00 kurt Exp .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59.
|
||||
#
|
||||
@ -24740,6 +24740,21 @@ echo "${ECHO_T}$ol_cv_pthread_create_works" >&6
|
||||
{ { echo "$as_me:$LINENO: error: pthread_create is not usable, check environment settings" >&5
|
||||
echo "$as_me: error: pthread_create is not usable, check environment settings" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
ol_replace_broken_yield=no
|
||||
case "$target" in
|
||||
*-*-linux*)
|
||||
ol_replace_broken_yield=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $ol_replace_broken_yield = yes ; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define REPLACE_BROKEN_YIELD 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
if test $ol_with_yielding_select = auto ; then
|
||||
@ -42898,7 +42913,6 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in \
|
||||
@ -42950,7 +42964,6 @@ for ac_func in \
|
||||
strtoll \
|
||||
strspn \
|
||||
sysconf \
|
||||
usleep \
|
||||
waitpid \
|
||||
wait4 \
|
||||
write \
|
||||
|
13
configure.in
13
configure.in
@ -1585,6 +1585,18 @@ dnl [ol_cv_pthread_lpthread_lexc])
|
||||
AC_MSG_ERROR([pthread_create is not usable, check environment settings])
|
||||
fi
|
||||
|
||||
ol_replace_broken_yield=no
|
||||
case "$target" in
|
||||
*-*-linux*)
|
||||
ol_replace_broken_yield=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $ol_replace_broken_yield = yes ; then
|
||||
AC_DEFINE([REPLACE_BROKEN_YIELD],1,
|
||||
[define if sched_yield yields the entire process])
|
||||
fi
|
||||
|
||||
dnl Check if select causes an yield
|
||||
if test $ol_with_yielding_select = auto ; then
|
||||
AC_CACHE_CHECK([if select yields when using pthreads],
|
||||
@ -2564,7 +2576,6 @@ AC_CHECK_FUNCS( \
|
||||
strtoll \
|
||||
strspn \
|
||||
sysconf \
|
||||
usleep \
|
||||
waitpid \
|
||||
wait4 \
|
||||
write \
|
||||
|
@ -777,9 +777,6 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
@ -903,6 +900,9 @@
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* define if sched_yield yields the entire process */
|
||||
#undef REPLACE_BROKEN_YIELD
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
|
@ -20,6 +20,13 @@
|
||||
|
||||
#include <ac/errno.h>
|
||||
|
||||
#ifdef REPLACE_BROKEN_YIELD
|
||||
#ifndef HAVE_NANOSLEEP
|
||||
#include <ac/socket.h>
|
||||
#endif
|
||||
#include <ac/time.h>
|
||||
#endif
|
||||
|
||||
#include "ldap_pvt_thread.h" /* Get the thread interface */
|
||||
#define LDAP_THREAD_IMPLEMENTATION
|
||||
#define LDAP_THREAD_RDWR_IMPLEMENTATION
|
||||
@ -207,7 +214,16 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
|
||||
int
|
||||
ldap_pvt_thread_yield( void )
|
||||
{
|
||||
#if HAVE_THR_YIELD
|
||||
#ifdef REPLACE_BROKEN_YIELD
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
struct timespec t = { 0, 0 };
|
||||
nanosleep(&t, NULL);
|
||||
#else
|
||||
struct timeval tv = {0,0};
|
||||
select( 0, NULL, NULL, NULL, &tv );
|
||||
#endif
|
||||
return 0;
|
||||
#elif HAVE_THR_YIELD
|
||||
return thr_yield();
|
||||
|
||||
#elif HAVE_PTHREADS == 10
|
||||
|
Loading…
Reference in New Issue
Block a user