networksecurity/ipsec/cscommon/src/srvstatic.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2003-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 <e32svr.h>
       
    17 
       
    18 #include "srvstarter.h"
       
    19 
       
    20 static void RunServerL()
       
    21 //
       
    22 // Perform all server initialisation, in particular creation of the
       
    23 // scheduler and server and then run the scheduler
       
    24 //
       
    25     {
       
    26     // create and install the active scheduler we need
       
    27     CActiveScheduler* s=new(ELeave) CActiveScheduler;
       
    28     CleanupStack::PushL(s);
       
    29     CActiveScheduler::Install(s);
       
    30     //
       
    31     // create the server
       
    32     CServer2* server = Starter::CreateAndStartServerL();
       
    33     CleanupStack::PushL(server);
       
    34     //
       
    35     
       
    36     // naming the server thread after server startup helps to debug panics
       
    37     User::LeaveIfError(RThread::RenameMe(Starter::ServerName()));
       
    38     
       
    39     // Initialisation complete, now signal the client
       
    40     RProcess::Rendezvous(KErrNone);
       
    41     
       
    42     //
       
    43     // Ready to run
       
    44     CActiveScheduler::Start();
       
    45     //
       
    46     // Cleanup the server and scheduler
       
    47     CleanupStack::PopAndDestroy(2); // server, s
       
    48     }
       
    49 
       
    50 TInt E32Main()
       
    51 //
       
    52 // Server process entry-point
       
    53 //
       
    54     {
       
    55     __UHEAP_MARK;
       
    56     
       
    57     CTrapCleanup* cleanup=CTrapCleanup::New();
       
    58     TInt r=KErrNoMemory;
       
    59     if (cleanup)
       
    60         {
       
    61         TRAP(r,RunServerL());
       
    62         delete cleanup;
       
    63         }
       
    64     
       
    65     __UHEAP_MARKEND;
       
    66     return r;
       
    67     }