diff -r 9e077f9a342c -r 2c7f27287390 idlefw/tsrc/utility/mt_aiutils/CAOUserAfter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlefw/tsrc/utility/mt_aiutils/CAOUserAfter.h Thu Jul 15 18:59:18 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2010 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: +* +*/ +#ifndef __CAOUSERAFTER_H__ +#define __CAOUSERAFTER_H__ + +// INCLUDES +#include +#include +#include + + +/** + * Active object version of User::After() + */ +class CAOUserAfter : public CTimer + { + private: + CActiveSchedulerWait iWait; + TInt iLength; + + + public: //new functions + + /** + * Constructs the waiting timer, executes + * it and when timer expires, deletes self. + * @param aLength The lenghth of wait in micro + * seconds. + */ + static void AfterLD( TInt aLenght ) + { + CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght ); + CleanupStack::PushL( wait ); + wait->ConstructL(); + CleanupStack::Pop(); + + RDebug::Print( _L("CAOUserAfter - Starting time consuming...") ); + wait->StartWaitD(); + RDebug::Print( _L("CAOUserAfter - completed.") ); + } + + private: + CAOUserAfter( TInt aLenght ) + : CTimer( CActive::EPriorityStandard ), + iLength( aLenght ) + { + } + + void ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + } + + virtual ~CAOUserAfter() + { + } + + void StartWaitD() + { + After( iLength ); + iWait.Start(); + } + + void RunL() + { + iWait.AsyncStop(); + Cancel(); + delete this; + } + }; + +#endif // __CAOUSERAFTER_H__ +// End of File +