diff -r 000000000000 -r c6b0df440bee dbgagents/trkagent/dbgtrccomm/server/dbgtrcsrvmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbgagents/trkagent/dbgtrccomm/server/dbgtrcsrvmain.cpp Tue Mar 02 10:33:16 2010 +0530 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +// User includes +#include "dbgtrccmdcodes.h" +#include "dbgtrcsrvscheduler.h" +#include "dbgtrcsrvserver.h" + + +void RunServerL(); + +// +// RunServerL() +// Creates tcb server, signals the client and starts the server +// + +void RunServerL() +{ + // Set the process and thread priority to absolute high. + //RProcess().SetPriority(EPriorityHigh); + //RThread().SetPriority(EPriorityAbsoluteHigh); + + // Create and install the active scheduler we need + CDbgTrcSrvScheduler* scheduler = CDbgTrcSrvScheduler::NewLC(); + if (scheduler == 0) + User::Leave(KErrNoMemory); + + CActiveScheduler::Install(scheduler); + + // Create server + CDbgTrcSrvServer::NewLC(); + + // Initialisation complete, now signal the client +#ifdef EKA2 + User::LeaveIfError(User::RenameThread(KDbgTrcServerName)); +#else + User::LeaveIfError(RThread().RenameMe(KDbgTrcServerName)); +#endif + RProcess::Rendezvous(KErrNone); + + // Ready to run + CActiveScheduler::Start(); + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2, scheduler); +} + + + +// +// Main Entry Point +// + +TInt E32Main() +{ + __UHEAP_MARK; + + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == 0) + User::Panic(_L("MetroTrk Tcb Server failed to allocate CTrapCleanup"), __LINE__); + + TInt error = KErrNone; + + if (cleanup) + { + TRAP(error, RunServerL()); + delete cleanup; + } + + if (error != KErrNone) + { + User::Panic(_L("MetroTrk Tcb Server failed to start"), __LINE__); + } + + __UHEAP_MARKEND; + + return error; +} +