ncdengine/debuglogger/src/OsmDelay.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   COsmDelay implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "OsmDelay.h"
       
    20 
       
    21 static TInt DelayTimerCallBack( TAny* /*aParam*/ )
       
    22     {
       
    23     CActiveScheduler::Stop();
       
    24     return 0;
       
    25     }
       
    26 
       
    27 void COsmDelay::SynchronousWaitL( TInt aTime )
       
    28     {
       
    29     COsmDelay* self = NewL( TCallBack( DelayTimerCallBack, 0 ) );
       
    30     CleanupStack::PushL( self );
       
    31     self->After( aTime );
       
    32     CActiveScheduler::Start();
       
    33     CleanupStack::PopAndDestroy( self );
       
    34     }
       
    35 
       
    36 
       
    37 COsmDelay* COsmDelay::NewL( TCallBack aCallBack )
       
    38     {
       
    39     COsmDelay* self = new(ELeave) COsmDelay( aCallBack );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop( self );
       
    43     return self;
       
    44     }
       
    45 
       
    46 COsmDelay::COsmDelay( TCallBack aCallBack ) 
       
    47     : CTimer( EPriorityStandard ),
       
    48       iCallBack( aCallBack )
       
    49     {
       
    50     CActiveScheduler::Add( this );
       
    51     }
       
    52  
       
    53 void COsmDelay::RunL()
       
    54     {
       
    55     iCallBack.CallBack();
       
    56     }
       
    57 
       
    58