void CRcpOutgoingCommandHandler::ClearQueue(TDblQue<CControlCommand>& aQue)
	{
	while(!aQue.IsEmpty())
		{
		CControlCommand* command = aQue.First();
		command->CancelTimer(iTimer);
		command->iHandlingLink.Deque();
		command->DecrementUsers();
		}
	}
void CRcpOutgoingCommandHandler::ProcessDisconnect(TDblQue<CControlCommand>& aQue, TBool aClearQueue)
	{
	while(!aQue.IsEmpty())
		{
		CControlCommand* command = aQue.First();
		iRouter.RemoveFromSendQueue(*command);
		command->CancelTimer(iTimer);
		
		if(aClearQueue)
			{
			GenerateFailureResult(*command, KErrDisconnected);
			}

		command->iHandlingLink.Deque();
		command->DecrementUsers();
		}
	}
示例#3
0
// Activates work items sitting in the queue
void CEcmtSdkPlugin::FlushQueue(TBool aFinal)
{
    // Lock the queue
    Emulator::Escape();
    WaitForSingleObject(iMutex, INFINITE);
    Emulator::Reenter();

    // Move queued callbacks to a temp queue
    TDblQue<WorkItem> q;
    while (!iQueue.IsEmpty()) {
        WorkItem* workItem = iQueue.Last();
        workItem->Deque();
        q.AddFirst(*workItem);
    }
    if (aFinal) {
        iRunner->Cancel();
    } else {
        iRunner->iStatus = KRequestPending;
        iRunner->SetActive();
    }
    ReleaseMutex(iMutex);

    // Invoke the callbacks
    while (!q.IsEmpty()) {
        WorkItem* w = q.First();
        w->Deque();
        TRACE2("[%08X] running work item %08X",this,w);
	
	if ((*w->iCallback != NULL) && (w->iArg1 != NULL))
	{ 
        TRAPD(err,(*w->iCallback)(w->iArg1,w->iArg2,w->iArg3));
	}
	 if (w->iEvent)
       	 	{
            		TRACE2("[%08X] setting event for work item %08X",this,w);
           		SetEvent(w->iEvent);
        	}
        MemFree(w);
    }
}
示例#4
0
void CMemDir::LoadDirL(const TDesC& aPath)
//
// Load a directory.
//
	{

	TheLevel++;
	iPath=aPath.AllocL();
	TFileName name=Name(_L("*.*"));
	test.Printf(_L("%*p%S\n"),TheLevel<<1,&name);
	CDir* pD;
	test(TheFs.GetDir(Name(_L("*.*")),KEntryAttMatchMask,EDirsFirst|ESortByName,pD)==KErrNone);
	TInt count=pD->Count();
	TInt i=0;
	while (i<count)
		{
		const TEntry& e=(*pD)[i++];
		TParse parse;
		parse.Set(e.iName,NULL,NULL);
		if (!parse.Ext().CompareF(_L(".NCB")))
			continue; // Ignore .ncb files - cannot open/read them.
		CMemEntry* pE=CMemEntry::New(e);
		iEntryQ.AddLast(*pE);
		}
	delete pD;
	TDblQueIter<CMemEntry> q(iEntryQ);
	CMemEntry* pE;
	while ((pE=q++)!=NULL)
		{
		if (pE->IsDir())
			{
			CMemDir* pM=CMemDir::NewL();
			pE->SetDir(*pM);
			pM->LoadDirL(Name(pE->Name()));
			}
		else
			pE->SetDir(*this);
		}
	TheLevel--;
	}