bearermanagement/mpm/src/mpmstarter.cpp
changeset 71 9f263f780e41
parent 32 5c4486441ae6
equal deleted inserted replaced
70:ac5daea24fb0 71:9f263f780e41
     1 /*
     1 /*
     2 * Copyright (c) 2004-2005 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 
    22 
    23 // INCLUDE FILES
    23 // INCLUDE FILES
    24 #include <e32svr.h>
    24 #include <e32svr.h>
    25 
    25 
    26 #include "mpmstarter.h"
    26 #include "mpmstarter.h"
       
    27 #include "mpmscheduler.h"
    27 #include "mpmserver.h"
    28 #include "mpmserver.h"
    28 #include "mpmlogger.h"
    29 #include "mpmlogger.h"
    29 
    30 
    30 // ============================= LOCAL FUNCTIONS ===============================
    31 // ============================= LOCAL FUNCTIONS ===============================
    31 
    32 
    35 // -----------------------------------------------------------------------------
    36 // -----------------------------------------------------------------------------
    36 //
    37 //
    37 static void RunServerL()
    38 static void RunServerL()
    38     {
    39     {
    39     MPMLOGSTRING( "MPMStarter::RunServerL" )
    40     MPMLOGSTRING( "MPMStarter::RunServerL" )
    40     // create and install the active scheduler we need
    41     // Create and install the active scheduler
    41     CActiveScheduler* s=new( ELeave ) CActiveScheduler;
    42     CMpmScheduler* scheduler = CMpmScheduler::NewLC();
    42     CleanupStack::PushL( s );
    43     CActiveScheduler::Install( scheduler );
    43     CActiveScheduler::Install( s );
    44 
    44     //
    45     // Create the server
    45     // create the server
       
    46     CServer2* server = MPMStarter::CreateAndStartServerL();
    46     CServer2* server = MPMStarter::CreateAndStartServerL();
    47     CleanupStack::PushL( server );
    47     CleanupStack::PushL( server );
       
    48     scheduler->SetMpmServer( server );
    48 
    49 
    49     User::LeaveIfError( RThread::RenameMe( MPMStarter::ServerName() ) );
    50     User::LeaveIfError( RThread::RenameMe( MPMStarter::ServerName() ) );
    50 
    51 
    51     // Initialisation complete, now signal the client
    52     // Initialisation complete, now signal the client
    52     RProcess::Rendezvous( KErrNone );
    53     RProcess::Rendezvous( KErrNone );
    53 
    54 
    54     // Ready to run
    55     // Ready to run
    55     CActiveScheduler::Start();
    56     CActiveScheduler::Start();
    56     //
    57 
    57     // Cleanup the server and scheduler
    58     // Cleanup the server and scheduler
    58     CleanupStack::PopAndDestroy( server );
    59     CleanupStack::PopAndDestroy( server );
    59     CleanupStack::PopAndDestroy( s );
    60     CleanupStack::PopAndDestroy( scheduler );
    60     }
    61     }
    61 
    62 
    62 
    63 
    63 // -----------------------------------------------------------------------------
    64 // -----------------------------------------------------------------------------
    64 // Server process entry-point
    65 // Server process entry-point