Exemplo n.º 1
0
/* Remove record with document info, return result from database call */
void RemoveDocInfoRecord
    (
    UInt16 index    /* record index */
    )
    /* THROWS */
{
    Err err;

    err = RemoveRecord( plkrDocList, index );
    THROW_IF( err != errNone, err );
}
Exemplo n.º 2
0
bool
CacheIndexIterator::ReplaceRecord(CacheIndexRecord *aOldRecord,
                                  CacheIndexRecord *aNewRecord)
{
  LOG(("CacheIndexIterator::ReplaceRecord() [this=%p, oldRecord=%p, "
       "newRecord=%p]", this, aOldRecord, aNewRecord));

  if (RemoveRecord(aOldRecord)) {
    AddRecord(aNewRecord);
    return true;
  }

  return false;
}
BOOL CWriteMonitorResult::Run()
{
	vector<CFileAction *>::iterator iter;
	vector<CFileAction *> ListCopy;
	while(!m_bExit)
	{
		EnterCriticalSection(&g_FileActionListCS);
		ListCopy.assign(g_MonotorFileActionList.begin(),g_MonotorFileActionList.end());
		g_MonotorFileActionList.clear();
		LeaveCriticalSection(&g_FileActionListCS);

		if (ListCopy.empty())
		{
			Sleep(1000);
			continue;
		}
		
		iter = ListCopy.begin(); 
		for (iter;iter!=ListCopy.end();)
		{
			if (m_bExit)
				break;

			if ((*iter)->m_Type == CFileAction::AC_ADD)
				AddRecord(*iter);

			else if ((*iter)->m_Type == CFileAction::AC_DEL)
				RemoveRecord(*iter);

			else if ((*iter)->m_Type == CFileAction::AC_RENAME)
				ModifyRecord(*iter);

			iter = ListCopy.erase(iter);
		}

		for (size_t i=0;i< ListCopy.size();i++)
			delete ListCopy[i];

		ListCopy.clear();
	}
	
	return TRUE;
}