genericservices/taskscheduler/Test/TSUtils/TTaskSchedulerLauncher.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 	}