|
1 /* |
|
2 * Copyright (c) 2010 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: AlfSynchronizer waits for synchronization to complete |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __ALFSYNCHRONIZER_H__ |
|
21 #define __ALFSYNCHRONIZER_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 /** |
|
27 * Synchronization active object. |
|
28 */ |
|
29 NONSHARABLE_CLASS( CAlfSynchronizer ) : public CActive |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * Two phase constructor. |
|
35 */ |
|
36 static CAlfSynchronizer* NewL(); |
|
37 |
|
38 /** |
|
39 * C++ destructor |
|
40 */ |
|
41 ~CAlfSynchronizer(); |
|
42 |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Starts to wait for synchronization to complete |
|
47 * with particular identifier. |
|
48 * This will start nested active scheduler. |
|
49 */ |
|
50 void Start(TInt aId); |
|
51 |
|
52 private: |
|
53 |
|
54 /** |
|
55 * C++ constructor |
|
56 */ |
|
57 CAlfSynchronizer(); |
|
58 |
|
59 /** |
|
60 * ConstructL |
|
61 */ |
|
62 void ConstructL(); |
|
63 |
|
64 void RunL(); |
|
65 void DoCancel(); |
|
66 |
|
67 static TInt CallbackSyncTimeout( TAny* aPtr ); |
|
68 void DoCallbackSyncTimeout(); |
|
69 |
|
70 private: // data |
|
71 |
|
72 /** |
|
73 * Active scheduler waiter. |
|
74 * Own. |
|
75 */ |
|
76 CActiveSchedulerWait* iWait; |
|
77 |
|
78 /** |
|
79 * P&S property for monitoring a variable. |
|
80 * Own. |
|
81 */ |
|
82 RProperty iProperty; |
|
83 |
|
84 /** |
|
85 * Timer to ensure that this synchronizer has finite duration. |
|
86 * Own. |
|
87 */ |
|
88 CPeriodic* iTimeout; |
|
89 |
|
90 /** |
|
91 * Id waiting to be completed. |
|
92 */ |
|
93 TInt iSynchId; |
|
94 |
|
95 /** |
|
96 * ETrue if @c iWait has been stop. |
|
97 * EFalse otherwise. |
|
98 */ |
|
99 TBool iAsyncStopDone; |
|
100 }; |
|
101 |
|
102 #endif //__ALFSYNCHRONIZER_H__ |