os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/src/entry.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-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 the License "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 /**
    17  @file
    18  @internalTechnology
    19 */
    20 
    21 #include <e32base.h>
    22 
    23 #include "cusbhostmsserver.h"
    24 
    25 static void RunServerL()
    26 //
    27 // Perform all server initialisation, in particular creation of the
    28 // scheduler and server and then run the scheduler
    29 //
    30     {
    31 	CUsbHostMsServer* iServer;
    32 
    33     // naming the server thread after the server helps to debug panics
    34     //
    35     // create and install the active scheduler we need
    36     CActiveScheduler* s=new(ELeave) CActiveScheduler;
    37     CleanupStack::PushL(s);
    38     CActiveScheduler::Install(s);
    39 
    40 	iServer = CUsbHostMsServer::NewLC();
    41 	CleanupStack::PushL(iServer);
    42 
    43     //
    44     // Initialisation complete, now signal the client
    45     RProcess::Rendezvous(KErrNone);
    46     //
    47     // Ready to run
    48     CActiveScheduler::Start();
    49     //
    50     // Cleanup the server and scheduler
    51     CleanupStack::PopAndDestroy(2);
    52     }
    53 
    54 TInt E32Main()
    55 //
    56 // Server process entry-point
    57 //
    58     {
    59     __UHEAP_MARK;
    60     //
    61     CTrapCleanup* cleanup=CTrapCleanup::New();
    62     TInt r=KErrNoMemory;
    63     if (cleanup)
    64         {
    65         TRAP(r,RunServerL());
    66         delete cleanup;
    67         }
    68     //
    69     __UHEAP_MARKEND;
    70     return r;
    71     }