userlibandfileserver/fileserver/shostmassstorage/server/src/entry.cpp
changeset 43 96e5fb8b040d
child 33 0173bcd7697c
equal deleted inserted replaced
-1:000000000000 43:96e5fb8b040d
       
     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 #include <e32base_private.h>
       
    23 
       
    24 #include "msctypes.h"
       
    25 #include "shared.h"
       
    26 #include "msgservice.h"
       
    27 #include "cusbhostmslogicalunit.h"
       
    28 #include "cusbhostmsdevice.h"
       
    29 #include "cusbhostmsserver.h"
       
    30 
       
    31 static void RunServerL()
       
    32 //
       
    33 // Perform all server initialisation, in particular creation of the
       
    34 // scheduler and server and then run the scheduler
       
    35 //
       
    36     {
       
    37 	CUsbHostMsServer* iServer;
       
    38 
       
    39     // naming the server thread after the server helps to debug panics
       
    40     //
       
    41     // create and install the active scheduler we need
       
    42     CActiveScheduler* s=new(ELeave) CActiveScheduler;
       
    43     CleanupStack::PushL(s);
       
    44     CActiveScheduler::Install(s);
       
    45 
       
    46 	iServer = CUsbHostMsServer::NewLC();
       
    47 	CleanupStack::PushL(iServer);
       
    48 
       
    49     //
       
    50     // Initialisation complete, now signal the client
       
    51     RProcess::Rendezvous(KErrNone);
       
    52     //
       
    53     // Ready to run
       
    54     CActiveScheduler::Start();
       
    55     //
       
    56     // Cleanup the server and scheduler
       
    57     CleanupStack::PopAndDestroy(2);
       
    58     }
       
    59 
       
    60 TInt E32Main()
       
    61 //
       
    62 // Server process entry-point
       
    63 //
       
    64     {
       
    65     __UHEAP_MARK;
       
    66     //
       
    67     CTrapCleanup* cleanup=CTrapCleanup::New();
       
    68     TInt r=KErrNoMemory;
       
    69     if (cleanup)
       
    70         {
       
    71         TRAP(r,RunServerL());
       
    72         delete cleanup;
       
    73         }
       
    74     //
       
    75     __UHEAP_MARKEND;
       
    76     return r;
       
    77     }