|
1 /* |
|
2 * Copyright (c) 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 |
|
18 #include <e32std.h> |
|
19 #include <f32file.h> |
|
20 // User includes |
|
21 #include "dbgtrccmdcodes.h" |
|
22 #include "dbgtrcsrvscheduler.h" |
|
23 #include "dbgtrcsrvserver.h" |
|
24 |
|
25 |
|
26 void RunServerL(); |
|
27 |
|
28 // |
|
29 // RunServerL() |
|
30 // Creates tcb server, signals the client and starts the server |
|
31 // |
|
32 |
|
33 void RunServerL() |
|
34 { |
|
35 // Set the process and thread priority to absolute high. |
|
36 //RProcess().SetPriority(EPriorityHigh); |
|
37 //RThread().SetPriority(EPriorityAbsoluteHigh); |
|
38 |
|
39 // Create and install the active scheduler we need |
|
40 CDbgTrcSrvScheduler* scheduler = CDbgTrcSrvScheduler::NewLC(); |
|
41 if (scheduler == 0) |
|
42 User::Leave(KErrNoMemory); |
|
43 |
|
44 CActiveScheduler::Install(scheduler); |
|
45 |
|
46 // Create server |
|
47 CDbgTrcSrvServer::NewLC(); |
|
48 |
|
49 // Initialisation complete, now signal the client |
|
50 #ifdef EKA2 |
|
51 User::LeaveIfError(User::RenameThread(KDbgTrcServerName)); |
|
52 #else |
|
53 User::LeaveIfError(RThread().RenameMe(KDbgTrcServerName)); |
|
54 #endif |
|
55 RProcess::Rendezvous(KErrNone); |
|
56 |
|
57 // Ready to run |
|
58 CActiveScheduler::Start(); |
|
59 |
|
60 // Cleanup the server and scheduler |
|
61 CleanupStack::PopAndDestroy(2, scheduler); |
|
62 } |
|
63 |
|
64 |
|
65 |
|
66 // |
|
67 // Main Entry Point |
|
68 // |
|
69 |
|
70 TInt E32Main() |
|
71 { |
|
72 __UHEAP_MARK; |
|
73 |
|
74 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
75 if (cleanup == 0) |
|
76 User::Panic(_L("MetroTrk Tcb Server failed to allocate CTrapCleanup"), __LINE__); |
|
77 |
|
78 TInt error = KErrNone; |
|
79 |
|
80 if (cleanup) |
|
81 { |
|
82 TRAP(error, RunServerL()); |
|
83 delete cleanup; |
|
84 } |
|
85 |
|
86 if (error != KErrNone) |
|
87 { |
|
88 User::Panic(_L("MetroTrk Tcb Server failed to start"), __LINE__); |
|
89 } |
|
90 |
|
91 __UHEAP_MARKEND; |
|
92 |
|
93 return error; |
|
94 } |
|
95 |