os/mm/devsound/devsoundrefplugin/src/platsec/server/AudioServer/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 // Copyright (c) 2004-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 "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 #include <e32std.h>
    17 #include <ecom/ecom.h>
    18 #include "MmfDevSoundServer.h"
    19 
    20 
    21 EXPORT_C TInt CMMFDevSoundServer::StartThread(TAny* aParms)
    22 /**
    23 Thread entry-point function.
    24 The TServerStart objects is passed as the thread parameter
    25 **/
    26 	{
    27 	TInt err = KErrNone;
    28 #ifdef SYMBIAN_USE_SEPARATE_HEAPS
    29 	__UHEAP_MARK;
    30 #endif
    31 	TDevSoundServerStart* start = reinterpret_cast<TDevSoundServerStart*>(aParms);
    32 	CTrapCleanup* cleanup = CTrapCleanup::New();
    33 	if (!cleanup)
    34 		{
    35 		err = KErrNoMemory;
    36 		}
    37 	else
    38 		{
    39 		TRAP(err, StartThreadL(*start));
    40 		}
    41 	delete cleanup;
    42 	
    43 	REComSession::FinalClose();
    44 #ifdef SYMBIAN_USE_SEPARATE_HEAPS
    45 	__UHEAP_MARKEND;
    46 #endif
    47 	return err;
    48 	}
    49 
    50 void CMMFDevSoundServer::StartThreadL(TDevSoundServerStart& aStart)
    51 	{
    52 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
    53 	CleanupStack::PushL(sched);
    54 	
    55 	CActiveScheduler::Install(sched);
    56 	CMMFDevSoundServer* server = CMMFDevSoundServer::NewL(aStart.iAudioServer, aStart.iProcessId);
    57 	CleanupStack::PushL(server);
    58 	
    59 	//Rename and set the priority of devsound server
    60 	RenamePrioritizeServer();
    61 	
    62 	aStart.iDevSoundServerHandle = server->Server();
    63 	// Sync with the client and enter the active scheduler
    64 	RThread::Rendezvous(KErrNone);
    65 	sched->Start();
    66 
    67 	CleanupStack::PopAndDestroy(2, sched); // sched, server
    68 	}
    69