Пример #1
0
void AOSContextManager::_clearErrorHistory()
{
  while (m_ErrorHistory.size() > 0)
  {
    AOSContext *pC = (AOSContext *)m_ErrorHistory.popFront();
    _deleteContext(&pC);
  }
}
Пример #2
0
//----------------------------------------------------------------//
void AKUDeleteContext ( AKUContextID contextID ) {
	
	AKUSetContext ( contextID );
	if ( !gContext ) return;
	
	_deleteContext ( gContext );
	gContextMap->erase ( contextID );
	
	AKUSetContext ( 0 );
}
Пример #3
0
//----------------------------------------------------------------//
void AKUFinalize () {

	if ( gContextMap ) {

		ContextMapIt contextMapIt = gContextMap->begin ();
		for ( ; contextMapIt != gContextMap->end (); ++contextMapIt ) {
			AKUContext* context = contextMapIt->second;
			_deleteContext ( context );
		}
		
		delete gContextMap;
		gContextMap = 0;
	}
	
	if ( !gSysInit ) {
		moaicore::SystemFinalize ();
		gSysInit = true;
	}
}
Пример #4
0
void AOSContextManager::deallocate(AOSContext *p)
{
  if (p)
  {
    {
      ALock lock(m_InUseSync);
      CONTEXT_INUSE::iterator it = m_InUse.find(p);
      AASSERT(this, p && m_InUse.end() != it);
    
      m_InUse.erase(it);
    }
  }
  else
    return;

  //a_Log
  ARope rope("AOSContextManager::deallocate[",30);
  rope.append(AString::fromPointer(p));
  rope.append(']');
  p->useEventVisitor().startEvent(rope);
  
  //a_Write to log
  if (p->useEventVisitor().getErrorCount() > 0)
  {
    m_Services.useLog().add(p->useEventVisitor(), ALog::EVENT_CRITICAL_ERROR);
  }

  if (p->useEventVisitor().getErrorCount() > 0)
  {
    //a_Add to error history
    if (m_ErrorHistoryMaxSize > 0)
    {
      p->finalize();
      m_ErrorHistory.pushBack(p);
    }
    else
      _deleteContext(&p);

    while (m_ErrorHistory.size() > m_ErrorHistoryMaxSize)
    {
      //a_Remove last
      AOSContext *pC = (AOSContext *)m_ErrorHistory.popFront();
      _deleteContext(&pC);
    }
  }
  else
  {
    //a_Add to history
    if (m_HistoryMaxSize > 0)
    {
      p->finalize();
      m_History.pushBack(p);
    }
    else
    {
      _deleteContext(&p);
    }

    while (m_History.size() > m_HistoryMaxSize)
    {
      //a_Remove last
      AOSContext *pC = (AOSContext *)m_History.popFront();
      if (pC)
        _deleteContext(&pC);
    }
  }
}