sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #include sl@0: sl@0: #include "cusbhostmsserver.h" sl@0: sl@0: static void RunServerL() sl@0: // sl@0: // Perform all server initialisation, in particular creation of the sl@0: // scheduler and server and then run the scheduler sl@0: // sl@0: { sl@0: CUsbHostMsServer* iServer; sl@0: sl@0: // naming the server thread after the server helps to debug panics sl@0: // sl@0: // create and install the active scheduler we need sl@0: CActiveScheduler* s=new(ELeave) CActiveScheduler; sl@0: CleanupStack::PushL(s); sl@0: CActiveScheduler::Install(s); sl@0: sl@0: iServer = CUsbHostMsServer::NewLC(); sl@0: CleanupStack::PushL(iServer); sl@0: sl@0: // sl@0: // Initialisation complete, now signal the client sl@0: RProcess::Rendezvous(KErrNone); sl@0: // sl@0: // Ready to run sl@0: CActiveScheduler::Start(); sl@0: // sl@0: // Cleanup the server and scheduler sl@0: CleanupStack::PopAndDestroy(2); sl@0: } sl@0: sl@0: TInt E32Main() sl@0: // sl@0: // Server process entry-point sl@0: // sl@0: { sl@0: __UHEAP_MARK; sl@0: // sl@0: CTrapCleanup* cleanup=CTrapCleanup::New(); sl@0: TInt r=KErrNoMemory; sl@0: if (cleanup) sl@0: { sl@0: TRAP(r,RunServerL()); sl@0: delete cleanup; sl@0: } sl@0: // sl@0: __UHEAP_MARKEND; sl@0: return r; sl@0: }