os/ossrv/genericservices/taskscheduler/Test/TSUtils/TTaskSchedulerLauncher.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <e32base.h>
    17 #include <e32debug.h>
    18 
    19 /**
    20  * This function will Start Task Scheduler directly calling Schexe.exe
    21  * It is used for test performance of Task Scheduler
    22  */ 	
    23 static void LaunchTaskSchedulerL()
    24 	{
    25 
    26 	TRequestStatus stat;
    27 	RProcess server;
    28 	_LIT(KScheduleServerExe, "Schexe");
    29 	
    30 	RDebug::Print(_L("Launching Task Scheduler via System Startup\n"));
    31 	
    32 	User::LeaveIfError(server.Create(KScheduleServerExe, _L("sysstartschexe")));
    33 	server.Rendezvous(stat);
    34 	if (stat!=KRequestPending)
    35 		server.Kill(0);		// abort startup
    36 	else
    37 		server.Resume();	// logon OK - start the server
    38 	User::WaitForRequest(stat);		// wait for start or death
    39 	}
    40 		
    41 
    42 GLDEF_C TInt E32Main()
    43 	{
    44 	TInt err = KErrNoMemory;
    45 	CTrapCleanup* cleanup=CTrapCleanup::New();	//can fail
    46 	if (cleanup)
    47 		{
    48 		err = KErrNone;
    49 		TRAP(err, LaunchTaskSchedulerL())
    50 		delete cleanup;
    51 		}
    52 	return err;
    53 	}