|
1 // Copyright (c) 2004-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "MessagingTestUtilityServer.h" |
|
17 #include "messagingtestutility.h" |
|
18 |
|
19 static void RunServerL() |
|
20 // |
|
21 // Perform all server initialisation, in particular creation of the |
|
22 // scheduler and server and then run the scheduler |
|
23 // |
|
24 { |
|
25 |
|
26 // create and install the active scheduler we need |
|
27 CActiveScheduler* s=new(ELeave) CActiveScheduler; |
|
28 CleanupStack::PushL(s); |
|
29 CActiveScheduler::Install(s); |
|
30 |
|
31 // |
|
32 // create the server (leave it on the cleanup stack) |
|
33 CMessagingTestUtilityServer::NewLC(); |
|
34 // |
|
35 // naming the server thread after the server helps to debug panics |
|
36 User::LeaveIfError(RThread::RenameMe(KTestServerName)); |
|
37 // |
|
38 // Initialisation complete, now signal the client |
|
39 RProcess::Rendezvous(KErrNone); |
|
40 // |
|
41 // Ready to run |
|
42 CActiveScheduler::Start(); |
|
43 |
|
44 // Ready to exit. |
|
45 // Cleanup the server and scheduler |
|
46 CleanupStack::PopAndDestroy(2); |
|
47 } |
|
48 |
|
49 static TInt RunMessagingTestUtilityServer() |
|
50 // |
|
51 // Main entry-point for the server thread |
|
52 // |
|
53 { |
|
54 __UHEAP_MARK; |
|
55 // |
|
56 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
57 TInt r=KErrNoMemory; |
|
58 if (cleanup) |
|
59 { |
|
60 TRAP(r,RunServerL()); |
|
61 delete cleanup; |
|
62 } |
|
63 // |
|
64 __UHEAP_MARKEND; |
|
65 return r; |
|
66 } |
|
67 |
|
68 |
|
69 |
|
70 TInt E32Main() |
|
71 // EXE entry point function. |
|
72 { |
|
73 return RunMessagingTestUtilityServer(); |
|
74 } |
|
75 |
|
76 |
|
77 |
|
78 // |
|
79 // |
|
80 // |