genericservices/taskscheduler/SCHCLI/CSCH_UTL.CPP
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2004-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 <e32std.h>
       
    17 #include "CSCHCODE.H"
       
    18 #include <e32math.h>
       
    19 #include "SCHEXE.H"
       
    20 
       
    21 // Constants
       
    22 _LIT(KScheduleServerExe, "Schexe");
       
    23 const TUid KTaskSchedulerExeUid = { 0x10005399 }; 
       
    24 
       
    25   
       
    26 EXPORT_C TInt StartSch32()
       
    27 	{
       
    28 	TRequestStatus stat;
       
    29 	const TUidType serverUid(KNullUid, KNullUid, KTaskSchedulerExeUid);
       
    30 	RProcess server;
       
    31 	TInt r=server.Create(KScheduleServerExe,KNullDesC,serverUid);
       
    32 	if (r!=KErrNone)
       
    33 		return r;
       
    34 
       
    35 	server.Rendezvous(stat);
       
    36 	if (stat!=KRequestPending)
       
    37 		server.Kill(0);		// abort startup
       
    38 	else
       
    39 		server.Resume();	// logon OK - start the server
       
    40 	User::WaitForRequest(stat);		// wait for start or death
       
    41 	// we can't use the 'exit reason' if the server panicked as this
       
    42 	// is the panic 'reason' and may be '0' which cannot be distinguished
       
    43 	// from KErrNone
       
    44 	r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
       
    45 	server.Close();
       
    46 	return r;
       
    47 	}
       
    48 	
       
    49 
       
    50 
       
    51