From b12450d7d18487ebcc0accb542306aa4921ee3b3 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Wed, 28 Jun 2000 00:01:49 +0000 Subject: [PATCH] Bugzilla bug #41832: set the error codes if pthread_cond_wait or pthread_cond_timedwait fails. --- nsprpub/pr/src/pthreads/ptsynch.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index 00f05b57fdb7..d21b1c7d0660 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -256,7 +256,8 @@ static PRIntn pt_TimedWait( /* NSPR doesn't report timeouts */ #ifdef _PR_DCETHREADS - return (rv == -1 && errno == EAGAIN) ? 0 : rv; + if (rv == -1) return (errno == EAGAIN) ? 0 : errno; + else return rv; #else return (rv == ETIMEDOUT) ? 0 : rv; #endif @@ -384,7 +385,12 @@ PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout) PR_ASSERT(0 == cvar->lock->notified.length); thred->waiting = NULL; /* and now we're not */ if (_PT_THREAD_INTERRUPTED(thred)) goto aborted; - return (rv == 0) ? PR_SUCCESS : PR_FAILURE; + if (rv != 0) + { + _PR_MD_MAP_DEFAULT_ERROR(rv); + return PR_FAILURE; + } + return PR_SUCCESS; aborted: PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0); @@ -1081,7 +1087,12 @@ PR_IMPLEMENT(PRStatus) PRP_NakedWait( rv = pthread_cond_wait(&cvar->cv, &ml->mutex); else rv = pt_TimedWait(&cvar->cv, &ml->mutex, timeout); - return (rv == 0) ? PR_SUCCESS : PR_FAILURE; + if (rv != 0) + { + _PR_MD_MAP_DEFAULT_ERROR(rv); + return PR_FAILURE; + } + return PR_SUCCESS; } /* PRP_NakedWait */ PR_IMPLEMENT(PRStatus) PRP_NakedNotify(PRCondVar *cvar)