Update contrib.
1 // Copyright (c) 1999-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Redirection server for STDLIB test programs
15 // Implement a redirection server which uses ... a console.
22 #include <redircliinternal.h>
24 #include "testconsole.h"
26 _LIT(KReDirServerName,"RedirServer");
31 TRequestStatus* iStatus;
35 TInt threadFunction(TAny* aPtr)
37 // Create and run an active scheduler containing a RedirectionServer
40 CTrapCleanup* TheTrapCleanup=CTrapCleanup::New();
42 struct rendezvous* rvp = (struct rendezvous *)aPtr;
44 // start scheduler and server
45 CActiveScheduler *pA=new CActiveScheduler;
48 CActiveScheduler::Install(pA);
49 // ***** TRAP(ret, CRedirServer::NewL(CTestConsoleFactory::NewL());
50 TRAP(ret, CRedirServer2::NewL(CTestConsoleFactory::NewL()));
51 // ret=KErrNotSupported;
53 // signal to the caller that we've started (or failed!)
54 rvp->iCaller.RequestComplete(rvp->iStatus,ret);
57 // start fielding requests from clients
58 CActiveScheduler::Start();
61 delete TheTrapCleanup;
66 EXPORT_C int start_redirection_server()
68 // Try to start a redirection server thread, assuming there isn't one already
72 TInt err=probe.Connect();
75 return KErrNone; // server already exists
76 TRequestStatus status(KRequestPending);
78 rv.iCaller.Duplicate(RThread(),EOwnerProcess);
81 err=server.Create(KReDirServerName,threadFunction,0x2000,NULL,&rv);
85 User::WaitForRequest(status);