Пример #1
0
int CSnapIDPool::NewID()
{
	int64 Now = time_get();

	// process timed ids
	while(m_FirstTimed != -1 && m_aIDs[m_FirstTimed].m_Timeout < Now)
		RemoveFirstTimeout();
	
	int Id = m_FirstFree;
	dbg_assert(Id != -1, "id error");
	m_FirstFree = m_aIDs[m_FirstFree].m_Next;
	m_aIDs[Id].m_State = 1;
	m_Usage++;
	m_InUsage++;
	return Id;
}
Пример #2
0
void CSnapIDPool::TimeoutIDs()
{
	// process timed ids
	while(m_FirstTimed != -1)
		RemoveFirstTimeout();
}