os/mm/devsound/devsoundrefplugin/src/platsec/server/Policy/MmfAudioPolicyStart.cpp
Update contrib.
1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <ecom/ecom.h>
18 #include "MmfAudioPolicyServer.h"
20 _LIT(KMMFAudioPolicyServerName,"MMFAudioPolicyServer");
22 EXPORT_C TInt CMMFAudioPolicyServer::StartThread(TAny* aParms)
24 Thread entry-point function.
25 The TServerStart objects is passed as the thread parameter
30 //This line will be used if parameters need to be passed.
31 TServerStart* start = reinterpret_cast<TServerStart*>(aParms);
32 CTrapCleanup* cleanup = CTrapCleanup::New();
39 TRAP(err, StartThreadL(*start));
43 REComSession::FinalClose();
48 void CMMFAudioPolicyServer::StartThreadL(TServerStart& aStart)
50 CActiveScheduler* sched = new(ELeave) CActiveScheduler;
51 CleanupStack::PushL(sched);
53 CActiveScheduler::Install(sched);
54 //Rename Audio Policy server name
55 RThread audioPolicyThread;
57 name.Append(KMMFAudioPolicyServerName);
58 //We are ignoring the error code returned from User::RenameThread
59 //as it is not important here, may be for profiling
60 User::RenameThread(name);
61 CMMFAudioPolicyServer* server = CMMFAudioPolicyServer::NewL();
62 CleanupStack::PushL(server);
64 aStart.iPolicyServerHandle = server->Server();
65 // Sync with the client and enter the active scheduler
66 RThread::Rendezvous(KErrNone);
69 CleanupStack::PopAndDestroy(2, sched); // sched, server