Esempio n. 1
0
void
CMLink::HandleCommandRunning
	(
	const JIndex cmdID
	)
{
	assert( itsRunningCommand == NULL );

	const JSize fgCount = itsForegroundQ->GetElementCount();
	for (JIndex i=1; i<=fgCount; i++)
		{
		CMCommand* command = itsForegroundQ->NthElement(i);
		if (command->GetTransactionID() == cmdID)
			{
			itsRunningCommand = command;
			itsForegroundQ->RemoveElement(i);
			break;
			}
		}

	if (itsRunningCommand == NULL && !itsBackgroundQ->IsEmpty())
		{
		CMCommand* command = itsBackgroundQ->FirstElement();
		if (command->GetTransactionID() == cmdID)
			{
			itsRunningCommand = command;
			itsBackgroundQ->RemoveElement(1);
			}
		}
}