예제 #1
0
void CGameRunner::DoCancel()
{
	RProcess process;
	if(process.Open(iProcessId) == KErrNone) {
		process.LogonCancel(iStatus);
		process.Close();
	}
}
void CTestCalInterimApiSuiteStepBase::WaitForAgendaServerShutdown()
	{
	// the name of the agenda server process includes its uid like this [10003a5b]
	_LIT(KAgendaServerUIDMatch, "*[10003a5b]*");
	TFindProcess findProcess(KAgendaServerUIDMatch);
	
	TFullName fullName;
	
	TInt findProcessResult(KErrNone);
	findProcessResult = findProcess.Next(fullName);
	
	if (findProcessResult == KErrNone)
		{
		// find the latest agenda server process
		while (findProcessResult == KErrNone)
			{
			findProcessResult = findProcess.Next(fullName);
			}
			
		// The agenda server process is running so wait 
		RProcess process;
		if (process.Open(fullName) == KErrNone)
			{
			TRequestStatus processStatus;
			process.Logon(processStatus); // ask for a callback when the process ends
			
			// Don't wait for the server to close for longer than 7 seconds
			RTimer timeOutTimer;
			timeOutTimer.CreateLocal();
			TRequestStatus timeOutStatus;
			timeOutTimer.After(timeOutStatus, 7000000);
			
			// Wait for either the agenda server to close
			// or the time out timer to time out.
			User::WaitForRequest(processStatus, timeOutStatus);
			
			if (timeOutStatus.Int() == KRequestPending)
				{
				timeOutTimer.Cancel();
				User::WaitForRequest(timeOutStatus);
				}
			else
				{
				if (timeOutStatus.Int() == KErrNone)
					{
					// Agenda server shutdown request has timed out
					ERR_PRINTF1(KErrAgendaServerShutdownTimedOut);
					SetTestStepResult(EFail);
					}
				}

			timeOutTimer.Close();		
			process.LogonCancel(processStatus);	
			process.Close();
			}
		}
	}
예제 #3
0
TInt RMemSpySession::StartServer()
	{
	RProcess server;
	_LIT(KCommand, "start");
	const TUid KServerUid3 = {0xE5883BC2};
	TInt error = server.Create(KMemSpyServerName, KCommand);//, KServerUid3);
	
	if (error != KErrNone)
		return error;
	
	TRequestStatus startStatus, stopStatus;
	server.Logon(stopStatus);
	if (stopStatus != KRequestPending)
		{
		User::WaitForRequest(stopStatus);
		server.Kill(0);
		server.Close();
		return stopStatus.Int();
		}
	
	server.Rendezvous(startStatus);
	server.Resume();
	User::WaitForRequest(startStatus, stopStatus);
	if (startStatus == KRequestPending)
		{
		// not started yet, i.e. stopStatus was signaled
		server.Close();
		return stopStatus.Int();
		}
	
	// Rendezvous was called - the server is ready
	
	// We first need to cancel Logon
	server.LogonCancel(stopStatus);
	// We don't need this anymore
	server.Close();
	// Wait for LogonCancel to complete
	User::WaitForRequest(stopStatus);

	// Everything went OK
	return KErrNone;
	}
예제 #4
0
void CApaParentProcessMonitor::DoCancel()
	{
	iProcess.LogonCancel(iStatus);
	}