uifw/AvKon/akncompamode/srv/src/akncompasrv.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 15:57:43 +0300
branchRCL_3
changeset 15 c52421ed5f07
parent 0 2f259fa3e83a
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   Main process execution
*
*/


#include <e32base.h>
#include <e32std.h>

#include "akncompasrv.h"
#include "akncompaserver.h"

// --------------------------------------------------------------------------
// Run compa key-server
// --------------------------------------------------------------------------
static void RunServerL()
    {
    // Perform all server initialisation, in particular creation of the
    // scheduler and server and then run the scheduler

    // Naming the server thread after the server helps to debug panics
    User::LeaveIfError(RThread::RenameMe(KAknCompaSrvName));

    // Create and install the active scheduler
    CActiveScheduler* s = new(ELeave) CActiveScheduler;
    CleanupStack::PushL(s);
    CActiveScheduler::Install(s);

    // Create the server (leave it on the cleanup stack)
    CAknCompaServer::NewLC();

    // Initialisation complete, now signal the client
    RProcess::Rendezvous(KErrNone);

    // Set to high priority
    RThread thread;
    thread.SetProcessPriority(EPriorityHigh);

    // Ready to run
    CActiveScheduler::Start();

    // Cleanup the server and scheduler
    CleanupStack::PopAndDestroy(2);
    }

// --------------------------------------------------------------------------
//
// --------------------------------------------------------------------------
GLDEF_C TInt E32Main()
    {
    __UHEAP_MARK;

    CTrapCleanup* cleanup=CTrapCleanup::New();
    TInt r=KErrNoMemory;
    if (cleanup)
      {
      TRAP(r,RunServerL());
      delete cleanup;
      }

    __UHEAP_MARKEND;
    return r;
    }