|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 |
|
20 #include "timeout.h" |
|
21 |
|
22 // ================= MEMBER FUNCTIONS ======================= |
|
23 |
|
24 // --------------------------------------------------------- |
|
25 // CTimeout::NewL() |
|
26 // --------------------------------------------------------- |
|
27 // |
|
28 CTimeout* CTimeout::NewL( TInt aPriority, TCallBack aCallBack ) |
|
29 { |
|
30 CTimeout* timeout = new (ELeave) CTimeout( aPriority, aCallBack ); |
|
31 CleanupStack::PushL( timeout ); |
|
32 timeout->ConstructL(); |
|
33 CleanupStack::Pop( timeout ); |
|
34 return timeout; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------- |
|
38 // CTimeout::~CTimeout() |
|
39 // --------------------------------------------------------- |
|
40 // |
|
41 CTimeout::~CTimeout() |
|
42 { |
|
43 Cancel(); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // CTimeout::RunL() |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 void CTimeout::RunL() |
|
51 { |
|
52 #ifdef _DEBUG |
|
53 TBool again = |
|
54 #endif /* def _DEBUG */ |
|
55 iCallBack.CallBack(); |
|
56 // Assert that this is a "once-only" callback. |
|
57 __ASSERT_DEBUG( !again, User::Invariant() ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------- |
|
61 // CTimeout::RunError() |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 TInt CTimeout::RunError( TInt /*aError*/ ) |
|
65 { |
|
66 // Ignore the error (what else could we do?). |
|
67 return KErrNone; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CTimeout::CTimeout() |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 CTimeout::CTimeout( TInt aPriority, TCallBack aCallBack ) : |
|
75 CTimer( aPriority ), |
|
76 iCallBack( aCallBack ) |
|
77 { |
|
78 CActiveScheduler::Add( this ); |
|
79 } |
|
80 |
|
81 // End of File |