messagingfw/sendas/server/src/sendasserverstart.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     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 "csendasserver.h"
       
    17 #include "sendasservername.h"
       
    18 
       
    19 
       
    20 void StartSendAsServerL()
       
    21 	{
       
    22 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    23 	CleanupStack::PushL(scheduler);
       
    24 	CActiveScheduler::Install(scheduler);
       
    25 
       
    26 	// create the server (leave it on the cleanup stack)
       
    27 	CSendAsServer::NewLC();
       
    28 
       
    29 	// naming the server thread after the server helps to debug panics
       
    30 	User::LeaveIfError(User::RenameProcess(KSendAsServerName));
       
    31 
       
    32 	// initialisation complete, now signal the client.
       
    33 	RProcess::Rendezvous(KErrNone);
       
    34 
       
    35 	CActiveScheduler::Start();
       
    36 
       
    37 	CleanupStack::PopAndDestroy(2, scheduler);	// scheduler, server
       
    38 	}
       
    39 
       
    40 TInt E32Main()
       
    41 	{
       
    42 	__UHEAP_MARK;
       
    43 
       
    44 	CTrapCleanup* cleanup=CTrapCleanup::New();
       
    45 	TInt r=KErrNoMemory;
       
    46 	if (cleanup)
       
    47 		{
       
    48 		TRAP(r, StartSendAsServerL());
       
    49 		delete cleanup;
       
    50 		}	
       
    51 		
       
    52 	__UHEAP_MARKEND;
       
    53 	return r;
       
    54 	}
       
    55