From: Kurt Zeilenga Date: Tue, 12 Sep 2000 20:39:13 +0000 (+0000) Subject: More NT threading fixes X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2042 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a7d74e9080c64c83964774dd05cd48db608e608a;p=openldap More NT threading fixes --- diff --git a/libraries/libldap_r/thr_nt.c b/libraries/libldap_r/thr_nt.c index a96bf7b9ac..620da6b642 100644 --- a/libraries/libldap_r/thr_nt.c +++ b/libraries/libldap_r/thr_nt.c @@ -51,10 +51,7 @@ ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return ) { DWORD status; status = WaitForSingleObject( (HANDLE) thread, INFINITE ); - if (status == WAIT_FAILED) { - return -1; - } - return 0; + return status == WAIT_FAILED ? -1 : 0; } int @@ -124,8 +121,9 @@ ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex ) int ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex ) { - WaitForSingleObject( *mutex, INFINITE ); - return ( 0 ); + DWORD status; + status = WaitForSingleObject( *mutex, INFINITE ); + return status == WAIT_FAILED ? -1 : 0; } int @@ -139,12 +137,9 @@ int ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mp ) { DWORD status; - status = WaitForSingleObject( *mp, 0 ); - if ( (status == WAIT_FAILED) || (status == WAIT_TIMEOUT) ) - return 0; - else - return 1; + return status == WAIT_FAILED || status == WAIT_TIMEOUT + ? -1 : 0; } #endif