|
1 /* |
|
2 * Copyright (c) 2007 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: Main process execution |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <e32std.h> |
|
21 |
|
22 #include "akncompasrv.h" |
|
23 #include "akncompaserver.h" |
|
24 |
|
25 // -------------------------------------------------------------------------- |
|
26 // Run compa key-server |
|
27 // -------------------------------------------------------------------------- |
|
28 static void RunServerL() |
|
29 { |
|
30 // Perform all server initialisation, in particular creation of the |
|
31 // scheduler and server and then run the scheduler |
|
32 |
|
33 // Naming the server thread after the server helps to debug panics |
|
34 User::LeaveIfError(RThread::RenameMe(KAknCompaSrvName)); |
|
35 |
|
36 // Create and install the active scheduler |
|
37 CActiveScheduler* s = new(ELeave) CActiveScheduler; |
|
38 CleanupStack::PushL(s); |
|
39 CActiveScheduler::Install(s); |
|
40 |
|
41 // Create the server (leave it on the cleanup stack) |
|
42 CAknCompaServer::NewLC(); |
|
43 |
|
44 // Initialisation complete, now signal the client |
|
45 RProcess::Rendezvous(KErrNone); |
|
46 |
|
47 // Set to high priority |
|
48 RThread thread; |
|
49 thread.SetProcessPriority(EPriorityHigh); |
|
50 |
|
51 // Ready to run |
|
52 CActiveScheduler::Start(); |
|
53 |
|
54 // Cleanup the server and scheduler |
|
55 CleanupStack::PopAndDestroy(2); |
|
56 } |
|
57 |
|
58 // -------------------------------------------------------------------------- |
|
59 // |
|
60 // -------------------------------------------------------------------------- |
|
61 GLDEF_C TInt E32Main() |
|
62 { |
|
63 __UHEAP_MARK; |
|
64 |
|
65 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
66 TInt r=KErrNoMemory; |
|
67 if (cleanup) |
|
68 { |
|
69 TRAP(r,RunServerL()); |
|
70 delete cleanup; |
|
71 } |
|
72 |
|
73 __UHEAP_MARKEND; |
|
74 return r; |
|
75 } |