messagingfw/wappushfw/MiscPushMsgUtils/src/CAsyncWaiter.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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 // CASYNCWAITER.H
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "CAsyncWaiter.h"
       
    19 
       
    20 CAsyncWaiter* CAsyncWaiter::NewL()
       
    21 	{
       
    22 	CAsyncWaiter* self = new(ELeave) CAsyncWaiter();
       
    23 	self->ConstructL();
       
    24 	return self;
       
    25 	}
       
    26 
       
    27 CAsyncWaiter::CAsyncWaiter()
       
    28 	: CActive(EPriorityStandard)
       
    29 	{
       
    30 	
       
    31 	}	
       
    32 
       
    33 CAsyncWaiter::~CAsyncWaiter()
       
    34 	{
       
    35 	if(IsActive())
       
    36 		{
       
    37 		Cancel();
       
    38 		}
       
    39 	delete iWaiter;	
       
    40 	}
       
    41 	
       
    42 void CAsyncWaiter::ConstructL()
       
    43 	{
       
    44 	iWaiter = new(ELeave) CActiveSchedulerWait();
       
    45 	CActiveScheduler::Add(this);
       
    46 	}
       
    47 
       
    48 void CAsyncWaiter::StartAndWait()
       
    49 	{
       
    50 	SetActive();
       
    51 	iWaiter->Start();
       
    52 	}
       
    53 
       
    54 TInt CAsyncWaiter::Result() const
       
    55 	{
       
    56 	return iError;
       
    57 	}
       
    58 	
       
    59 void CAsyncWaiter::RunL()
       
    60 	{
       
    61 	iError = iStatus.Int();
       
    62 	iWaiter->AsyncStop();
       
    63 	}
       
    64 	
       
    65 void CAsyncWaiter::DoCancel()
       
    66 	{
       
    67 	}
       
    68 
       
    69