mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Make use of nanosleep/select as a sched_yeild(2) replacement
conditional on REPLACE_SCHED_YEILD. Configure support needed.
This commit is contained in:
parent
a614a1c16e
commit
21d15546d3
@ -20,8 +20,10 @@
|
|||||||
|
|
||||||
#include <ac/errno.h>
|
#include <ac/errno.h>
|
||||||
|
|
||||||
#if defined( HAVE_YIELDING_SELECT )
|
#if REPLACE_SCHED_YIELD
|
||||||
|
#ifndef HAVE_NANOSLEEP
|
||||||
#include <ac/socket.h>
|
#include <ac/socket.h>
|
||||||
|
#endif
|
||||||
#include <ac/time.h>
|
#include <ac/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -212,9 +214,14 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
|
|||||||
int
|
int
|
||||||
ldap_pvt_thread_yield( void )
|
ldap_pvt_thread_yield( void )
|
||||||
{
|
{
|
||||||
#if HAVE_YIELDING_SELECT
|
#ifdef REPLACE_SCHED_YIELD
|
||||||
|
#ifdef HAVE_NANOSLEEP
|
||||||
|
struct timespec t = { 0, 0 };
|
||||||
|
nanosleep(&t, NULL);
|
||||||
|
#else
|
||||||
struct timeval tv = {0,0};
|
struct timeval tv = {0,0};
|
||||||
select( 0, NULL, NULL, NULL, &tv );
|
select( 0, NULL, NULL, NULL, &tv );
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
#elif HAVE_THR_YIELD
|
#elif HAVE_THR_YIELD
|
||||||
return thr_yield();
|
return thr_yield();
|
||||||
|
Loading…
Reference in New Issue
Block a user