pd->out_flags = 0;
static PRInt32 CheckPollDescMethods(PRPollDesc *pds, PRIntn npds, PRInt16 *outReadFlags, PRInt16 *outWriteFlags){    PRInt32     ready = 0;    PRPollDesc  *pd, *epd;    PRInt16     *readFlag, *writeFlag;        for (pd = pds, epd = pd + npds, readFlag = outReadFlags, writeFlag = outWriteFlags;        pd < epd;        pd++, readFlag++, writeFlag++)    {        PRInt16  in_flags_read = 0,  in_flags_write = 0;        PRInt16 out_flags_read = 0, out_flags_write = 0;        if (NULL == pd->fd || pd->in_flags == 0) continue;        if (pd->in_flags & PR_POLL_READ)        {            in_flags_read = (pd->fd->methods->poll)(                pd->fd, pd->in_flags & ~PR_POLL_WRITE, &out_flags_read);        }        if (pd->in_flags & PR_POLL_WRITE)        {            in_flags_write = (pd->fd->methods->poll)(                pd->fd, pd->in_flags & ~PR_POLL_READ, &out_flags_write);        }        if ((0 != (in_flags_read & out_flags_read)) ||            (0 != (in_flags_write & out_flags_write)))        {            ready += 1;  /* some layer has buffer input */            pd->out_flags = out_flags_read | out_flags_write;        }                *readFlag = in_flags_read;        *writeFlag = in_flags_write;    }    return ready;}