|
1 /* |
|
2 * Copyright (c) 2000-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 the License "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 * E32MAIN |
|
16 * Entry point for Test Console Server |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <e32base.h> |
|
23 #include "tocspclientserver.h" |
|
24 #include "tocspserver.h" |
|
25 |
|
26 // Perform server initialisation, in particular creation of the scheduler and |
|
27 // server and then run the scheduler |
|
28 static void RunServerL() |
|
29 { |
|
30 // Naming the server thread after the server helps to debug panics |
|
31 User::LeaveIfError(RThread().RenameMe(Swi::Test::KOcspServer)); |
|
32 // Create and install the active scheduler we need |
|
33 CActiveScheduler* s= new(ELeave) CActiveScheduler; |
|
34 CleanupStack::PushL(s); |
|
35 CActiveScheduler::Install(s); |
|
36 // Create the server and leave it on the cleanup stack |
|
37 Swi::Test::COcspServer::NewLC(); |
|
38 // Init complete, signal the client |
|
39 RProcess::Rendezvous(KErrNone); |
|
40 // Ready to run |
|
41 CActiveScheduler::Start(); |
|
42 // Cleanup server and scheduler |
|
43 CleanupStack::PopAndDestroy(2); |
|
44 } |
|
45 |
|
46 // |
|
47 // Server process entry point |
|
48 // |
|
49 |
|
50 TInt E32Main() |
|
51 { |
|
52 __UHEAP_MARK; |
|
53 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
54 TInt err=KErrNoMemory; |
|
55 if (cleanup) |
|
56 { |
|
57 TRAP(err, RunServerL()); |
|
58 delete cleanup; |
|
59 } |
|
60 __UHEAP_MARKEND; |
|
61 return err; |
|
62 } |