00001 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // 00015 00016 #include <e32std.h> 00017 #include "threadserverstart.h" 00018 #include "threadserver.h" 00019 00024 EXPORT_C TInt CThreadServer::StartThread(TAny* /*aPointer*/) 00025 { 00026 __UHEAP_MARK; 00027 // 00028 CTrapCleanup* cleanup=CTrapCleanup::New(); 00029 TInt r=KErrNoMemory; 00030 if (cleanup) 00031 { 00032 TRAP(r,StartThreadL()); 00033 delete cleanup; 00034 } 00035 // 00036 __UHEAP_MARKEND; 00037 return r; 00038 } 00043 void CThreadServer::StartThreadL() 00044 { 00045 // 00046 // create and install the active scheduler we need 00047 CActiveScheduler* s=new(ELeave) CActiveScheduler; 00048 CleanupStack::PushL(s); 00049 CActiveScheduler::Install(s); 00050 // 00051 // create the server (leave it on the cleanup stack) 00052 CThreadServer::NewLC(); 00053 00054 //rename the thread server by appending thread id 00055 //in order to prevent same name re-create 00056 RenameServer(); 00057 // 00058 // Initialisation complete, now signal the client 00059 RThread::Rendezvous(KErrNone); 00060 // 00061 // Ready to run 00062 CActiveScheduler::Start(); 00063 // 00064 // Cleanup the server and scheduler 00065 CleanupStack::PopAndDestroy(2); 00066 } 00067 00068 //eof 00069 00070
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.