os/security/cryptomgmtlibs/securitycommonutils/source/scsserver/shutdowntimer.cpp
Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Implements the timer which stops the server after no sessions have been
16 * open for a defined period.
25 #include <scs/scsserver.h>
28 CShutdownTimer* CShutdownTimer::NewL(TInt aDelayUs)
30 Factory function allocates a new, initialized instance of CShutdownTimer.
32 @param aDelayUs Delay in microseconds.
33 @return New, initialized instance of CShutdownTimer.
34 The newly-created object is owned by the caller.
37 CShutdownTimer* self = new(ELeave) CShutdownTimer(aDelayUs);
38 CleanupStack::PushL(self);
39 self->ConstructL(); // CTimer implementation
40 CleanupStack::Pop(self);
44 CShutdownTimer::CShutdownTimer(TInt aDelayUs)
46 Record the shutdown period and add this object to the active scheduler.
48 @param aDelayUs Delay in microseconds.
50 : CTimer(CActive::EPriorityStandard),
53 CActiveScheduler::Add(this);
56 void CShutdownTimer::Restart()
58 Restart this timer. This timer should not be active when this
61 Once started, the timer can be stopped with the base class' Cancel function.
64 if(iImmediateTimeoutNextRestart)
66 CActiveScheduler::Stop();
74 void CShutdownTimer::ImmediateTimeoutNextRestart()
76 Timer should immediately expire when Restart is next called.
79 iImmediateTimeoutNextRestart = ETrue;
83 void CShutdownTimer::RunL()
85 Implement CActive by stopping the active scheduler, which
86 has the effect of breaking out of the server loop.
89 CActiveScheduler::Stop();