#include "ldap_pvt_thread.h"
-#if HAVE_PTHREADS == 4
+#if HAVE_PTHREADS < 6
# define LDAP_INT_THREAD_ATTR_DEFAULT pthread_attr_default
# define LDAP_INT_THREAD_CONDATTR_DEFAULT pthread_condattr_default
# define LDAP_INT_THREAD_MUTEXATTR_DEFAULT pthread_mutexattr_default
pthread_attr_t attr;
/* Always create the thread attrs, so we can set stacksize if we need to */
-#if HAVE_PTHREADS > 4
+#if HAVE_PTHREADS > 5
pthread_attr_init(&attr);
#else
pthread_attr_create(&attr);
#endif
#endif
rtn = pthread_create( thread, &attr, start_routine, arg );
-#if HAVE_PTHREADS > 4
+#if HAVE_PTHREADS > 5
pthread_attr_destroy(&attr);
#else
pthread_attr_delete(&attr);
-#endif
-#if HAVE_PTHREADS < 6
if( detach ) {
pthread_detach( thread );
}
int
ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
{
-#if HAVE_PTHREADS > 6
+#if ( HAVE_PTHREAD_KILL && HAVE_PTHREADS > 6 )
+ /* MacOS 10.1 is detected as v10 but has no pthread_kill() */
return pthread_kill( thread, signo );
-#elif HAVE_PTHREADS > 4
+#elif ( HAVE_PTHREAD_KILL && HAVE_PTHREADS > 4 )
if ( pthread_kill( thread, signo ) < 0 ) return errno;
return 0;
#else
int
ldap_pvt_thread_yield( void )
{
-#if HAVE_PTHREADS == 10
+#if HAVE_THR_YIELD
+ return thr_yield();
+
+#elif HAVE_PTHREADS == 10
return sched_yield();
#elif defined(_POSIX_THREAD_IS_GNU_PTH)
sched_yield();
return 0;
-#elif HAVE_THR_YIELD
- return thr_yield();
-
#elif HAVE_PTHREADS == 6
pthread_yield(NULL);
return 0;