messagingappbase/obexmtms/TObexMTM/SRC/CAsyncWaiter.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 	return self;
       
    24 	}
       
    25 
       
    26 CAsyncWaiter::CAsyncWaiter()
       
    27 	: CActive(EPriorityStandard)
       
    28 	{
       
    29 	CActiveScheduler::Add(this);
       
    30 	}	
       
    31 
       
    32 CAsyncWaiter::~CAsyncWaiter()
       
    33 	{
       
    34 	Cancel();
       
    35 	}
       
    36 	
       
    37 void CAsyncWaiter::StartAndWait()
       
    38 	{
       
    39 	SetActive();
       
    40 	CActiveScheduler::Start();
       
    41 	}
       
    42 	
       
    43 TInt CAsyncWaiter::Result() const
       
    44 	{
       
    45 	return iError;
       
    46 	}
       
    47 	
       
    48 void CAsyncWaiter::RunL()
       
    49 	{
       
    50 	iError = iStatus.Int();
       
    51 	CActiveScheduler::Stop();
       
    52 	}
       
    53 	
       
    54 void CAsyncWaiter::DoCancel()
       
    55 	{
       
    56 	iError = KErrCancel;
       
    57 	CActiveScheduler::Stop();
       
    58 	}
       
    59