(void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags); ready = CountReadyPollDescs(pds, npds);
ready = CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);
PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout){    PRInt16     readFlagsArray[DESCRIPTOR_FLAGS_ARRAY_SIZE];    PRInt16     writeFlagsArray[DESCRIPTOR_FLAGS_ARRAY_SIZE];        PRInt16     *readFlags  = readFlagsArray;    PRInt16     *writeFlags = writeFlagsArray;    PRInt16     *ioFlags = NULL;        PRThread    *thread = _PR_MD_CURRENT_THREAD();    PRInt32     ready;        if (npds > DESCRIPTOR_FLAGS_ARRAY_SIZE)    {        // we allocate a single double-size array. The first half is used        // for read flags, and the second half for write flags.        ioFlags = (PRInt16*)PR_Malloc(sizeof(PRInt16) * npds * 2);        if (!ioFlags)        {            PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);            return -1;        }                readFlags = ioFlags;        writeFlags = &ioFlags[npds];    }    if (timeout != PR_INTERVAL_NO_WAIT) {        intn        is;                // we have to be outside the lock when calling this, since        // it can call arbitrary user code (including other socket        // entry points)        (void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);        _PR_INTSOFF(is);        PR_Lock(thread->md.asyncIOLock);        PrepareForAsyncCompletion(thread, 0);        SetDescPollThread(pds, npds, thread);        (void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);        PR_Unlock(thread->md.asyncIOLock);        _PR_FAST_INTSON(is);        ready = CountReadyPollDescs(pds, npds);        if (ready == 0) {            WaitOnThisThread(thread, timeout);            // since we may have been woken by a pollable event firing,            // we have to check both poll methods and endpoints.            (void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);            (void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);            ready = CountReadyPollDescs(pds, npds);        }                thread->io_pending = PR_FALSE;        SetDescPollThread(pds, npds, NULL);    }    else {        (void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);        (void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);        ready = CountReadyPollDescs(pds, npds);        }    if (readFlags != readFlagsArray)        PR_Free(ioFlags);        return ready;}