cv->lock = lock; cv->sem = create_sem(0, "CVSem"); cv->handshakeSem = create_sem(0, "CVHandshake"); cv->signalSem = create_sem( 0, "CVSignal"); cv->signalBenCount = 0; cv->ns = cv->nw = 0; PR_ASSERT( cv->sem >= B_NO_ERROR ); PR_ASSERT( cv->handshakeSem >= B_NO_ERROR ); PR_ASSERT( cv->signalSem >= B_NO_ERROR );
if (acquire_sem(cvar->signalSem) == B_INTERRUPTED) { atomic_add( &cvar->signalBenCount, -1 ); return PR_FAILURE; }
PR_IMPLEMENT(PRCondVar*)    PR_NewCondVar (PRLock *lock){    PRCondVar *cv = PR_NEW( PRCondVar );    PR_ASSERT( NULL != lock );    if( NULL != cv )    {	cv->lock = lock;	cv->sem = create_sem(0, "CVSem");	cv->handshakeSem = create_sem(0, "CVHandshake");	cv->signalSem = create_sem( 0, "CVSignal");	cv->signalBenCount = 0;	cv->ns = cv->nw = 0;	PR_ASSERT( cv->sem >= B_NO_ERROR );	PR_ASSERT( cv->handshakeSem >= B_NO_ERROR );	PR_ASSERT( cv->signalSem >= B_NO_ERROR );    }    return cv;} /* PR_NewCondVar */