mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +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>
|
||||
|
||||
#if defined( HAVE_YIELDING_SELECT )
|
||||
#if REPLACE_SCHED_YIELD
|
||||
#ifndef HAVE_NANOSLEEP
|
||||
#include <ac/socket.h>
|
||||
#endif
|
||||
#include <ac/time.h>
|
||||
#endif
|
||||
|
||||
@ -212,9 +214,14 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
|
||||
int
|
||||
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};
|
||||
select( 0, NULL, NULL, NULL, &tv );
|
||||
#endif
|
||||
return 0;
|
||||
#elif HAVE_THR_YIELD
|
||||
return thr_yield();
|
||||
|
Loading…
Reference in New Issue
Block a user