From cc8aa38d7ddd20c1a1fef4b5fc73d94a7b204bd4 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 26 Jul 2002 03:15:25 +0000 Subject: [PATCH] Some tweaks for OS/390 pthreads. Func signatures are different, return val is 0/-1 with err in errno instead of in return val. --- libraries/libldap_r/thr_posix.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libraries/libldap_r/thr_posix.c b/libraries/libldap_r/thr_posix.c index 9178fba506..847e727010 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -97,6 +97,10 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread, #ifdef PTHREAD_CREATE_DETACHED } else { pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); +#elif HAVE_PTHREAD_OS390 + } else { + int st = __DETACHED; + pthread_attr_setdetachstate(&attr, &st); #endif } #endif @@ -107,6 +111,9 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread, #endif rtn = pthread_create( thread, &attr, start_routine, arg ); +#ifdef HAVE_PTHREAD_OS390 + if ( rtn == -1 ) rtn = errno; +#endif #if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED ) if( detach ) { @@ -141,14 +148,26 @@ ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return ) if (thread_return==NULL) thread_return=&dummy; #endif +#ifdef HAVE_PTHREAD_OS390 + int st = pthread_join( thread, thread_return ); + if ( st == -1 ) st = errno; + return st; +#else return pthread_join( thread, thread_return ); +#endif } int ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo ) { #ifdef HAVE_PTHREAD_KILL +#ifdef HAVE_PTHREAD_OS390 + int st = pthread_kill( thread, signo ); + if ( st == -1 ) st = errno; + return st; +#else return pthread_kill( thread, signo ); +#endif #else /* pthread package with DCE */ if (kill( getpid(), signo )<0) @@ -168,7 +187,11 @@ ldap_pvt_thread_yield( void ) return sched_yield(); #elif HAVE_PTHREAD_YIELD +#if HAVE_PTHREAD_OS390 + pthread_yield(NULL); +#else pthread_yield(); +#endif return 0; #elif HAVE_THR_YIELD -- 2.39.5