public int pop(ref IPEndPoint addr, ref Packet pkt) { lock (m_ListLock) { if (-1 == m_iLastEntry) { return(-1); } // no pop until the next schedulled time ulong ts = Timer.rdtsc(); if (ts < m_pHeap[0].m_llTimeStamp) { return(-1); } UDT u = m_pHeap[0].m_pUDT; remove_(u); if (!u.m_bConnected || u.m_bBroken) { return(-1); } // pack a packet from the socket if (u.packData(pkt, ref ts) <= 0) { return(-1); } addr = u.m_pPeerAddr; // insert a new entry, ts is the next processing time if (ts > 0) { insert_(ts, u); } return(1); } }