tstaskmonitor/server/src/main.cpp
changeset 94 dbb8300717f7
equal deleted inserted replaced
93:82b66994846c 94:dbb8300717f7
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #include "hsrunningappserver.h"
       
    18 #include <e32base.h>
       
    19 
       
    20 // -----------------------------------------------------------------------------
       
    21 //
       
    22 // -----------------------------------------------------------------------------
       
    23 //
       
    24 LOCAL_C void StartRunningAppServerL()
       
    25 {
       
    26     CActiveScheduler* activeScheduler = new( ELeave ) CActiveScheduler;
       
    27     CleanupStack::PushL( activeScheduler );
       
    28     CActiveScheduler::Install( activeScheduler );
       
    29     CServer2* serverObject = CRunningAppServer::NewLC();
       
    30     RProcess::Rendezvous( KErrNone );
       
    31     CActiveScheduler::Start();
       
    32     CleanupStack::PopAndDestroy( serverObject );
       
    33     CleanupStack::PopAndDestroy( activeScheduler );
       
    34 }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 LOCAL_C TInt StartRunningAppServer()
       
    41 {
       
    42     __UHEAP_MARK;
       
    43     TInt errNo(KErrNoMemory);
       
    44     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    45     if (cleanupStack) {
       
    46         TRAP(errNo, StartRunningAppServerL());
       
    47         delete cleanupStack;
       
    48     }
       
    49     __UHEAP_MARKEND;
       
    50     if (KErrNone != errNo) {
       
    51         RProcess::Rendezvous(errNo);
       
    52     }
       
    53     return errNo;
       
    54 }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 TInt E32Main()
       
    61 {
       
    62     return StartRunningAppServer();
       
    63 }