thread->io_pending = PR_FALSE;
void WaitOnThisThread(PRThread *thread, PRIntervalTime timeout){    intn is;    PRIntervalTime timein = PR_IntervalNow();	PRStatus status = PR_SUCCESS;	_PR_INTSOFF(is);	PR_Lock(thread->md.asyncIOLock);	if (timeout == PR_INTERVAL_NO_TIMEOUT) {	    while ((thread->io_pending) && (status == PR_SUCCESS))	        status = PR_WaitCondVar(thread->md.asyncIOCVar, PR_INTERVAL_NO_TIMEOUT);	} else {	    while ((thread->io_pending) && ((PRIntervalTime)(PR_IntervalNow() - timein) < timeout) && (status == PR_SUCCESS))	        status = PR_WaitCondVar(thread->md.asyncIOCVar, timeout);	}	if ((status == PR_FAILURE) && (PR_GetError() == PR_PENDING_INTERRUPT_ERROR)) {		thread->md.osErrCode = kEINTRErr;	} else if (thread->io_pending) {		thread->md.osErrCode = kETIMEDOUTErr;		PR_SetError(PR_IO_TIMEOUT_ERROR, kETIMEDOUTErr);	}	PR_Unlock(thread->md.asyncIOLock);	_PR_FAST_INTSON(is);}