os/mm/devsound/a3fdevsound/src/mmfdevsoundserver/mmfdevsoundserverstart.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 
     2 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 // All rights reserved.
     4 // This component and the accompanying materials are made available
     5 // under the terms of "Eclipse Public License v1.0"
     6 // which accompanies this distribution, and is available
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 //
     9 // Initial Contributors:
    10 // Nokia Corporation - initial contribution.
    11 //
    12 // Contributors:
    13 //
    14 // Description:
    15 //
    16 
    17 #include <e32std.h>
    18 #include <ecom/ecom.h>
    19 #include "mmfdevsoundserverstart.h"
    20 #include "mmfdevsoundserver.h"
    21 
    22 
    23 //OTHER EXPORTED FUNCTIONS 
    24 
    25 /**
    26  	CMMFDevSoundServer::StartThread
    27  	Thread entry-point function.
    28  	The TServerStart objects is passed as the thread parameter
    29  */
    30 EXPORT_C TInt CMMFDevSoundServer::StartThread(TAny* aParms)
    31 	{
    32 	TInt err = KErrNone;
    33 #ifdef SYMBIAN_USE_SEPARATE_HEAPS
    34 	__UHEAP_MARK;
    35 #endif
    36 	TDevSoundServerStart* start = reinterpret_cast<TDevSoundServerStart*>(aParms);
    37 	CTrapCleanup* cleanup = CTrapCleanup::New();
    38 	if (!cleanup)
    39 		{
    40 		err = KErrNoMemory;
    41 		}
    42 	else
    43 		{
    44 		TRAP(err, StartThreadL(*start));
    45 		}
    46 	delete cleanup;
    47 	
    48 	REComSession::FinalClose();
    49 #ifdef SYMBIAN_USE_SEPARATE_HEAPS
    50 	__UHEAP_MARKEND;
    51 #endif
    52 	return err;
    53 	}
    54 
    55 void CMMFDevSoundServer::StartThreadL(TDevSoundServerStart& aStart)
    56 	{
    57 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
    58 	CleanupStack::PushL(sched);
    59 	
    60 	CActiveScheduler::Install(sched);
    61 	CMMFDevSoundServer* server = CMMFDevSoundServer::NewL(aStart.iAudioServer, aStart.iProcessId);
    62 	CleanupStack::PushL(server);
    63 	
    64 	//Rename and set the priority of devsound server
    65 	RenamePrioritizeServer();
    66 	
    67 	aStart.iDevSoundServerHandle = server->Server();
    68 	// Sync with the client and enter the active scheduler
    69 	RThread::Rendezvous(KErrNone);
    70 	sched->Start();
    71 
    72 	CleanupStack::PopAndDestroy(2, sched); // sched, server
    73 	}
    74 
    75 //  End of File