|
1 /* |
|
2 * Copyright (c) 2004 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: See class definition below. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CTCGRIMREAPER_H__ |
|
19 #define __CTCGRIMREAPER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 // CLASS DEFINITION |
|
25 /** |
|
26 * CTcGrimreaper is responsible for killing a thread that has not reported |
|
27 * to the Watcher server withing the specified timeout time |
|
28 * (i.e. it seems to be hanging). |
|
29 */ |
|
30 class CTcGrimreaper |
|
31 : public CActive |
|
32 { |
|
33 public: // Constructors and destructor |
|
34 |
|
35 /** |
|
36 * Static constructor. |
|
37 * |
|
38 * @param aClient Reference to the client thread to be hunted. |
|
39 * @param aTimeout Life timeout |
|
40 * @return An initialised instance of this class. |
|
41 */ |
|
42 static CTcGrimreaper* NewL( const RThread& aClient, |
|
43 TInt aTimeout ); |
|
44 |
|
45 /// Destructor |
|
46 ~CTcGrimreaper(); |
|
47 |
|
48 private: // Constructors |
|
49 |
|
50 /** |
|
51 * Constructor. |
|
52 * |
|
53 * @param aTimeout Life timeout |
|
54 */ |
|
55 CTcGrimreaper( TInt aTimeout ); |
|
56 |
|
57 /// Default constructor. Not implemented. |
|
58 CTcGrimreaper(); |
|
59 |
|
60 /** |
|
61 * 2nd phase constructor. |
|
62 * |
|
63 * @param aClient Reference to the client thread to be hunted. |
|
64 */ |
|
65 void ConstructL( const RThread& aClient ); |
|
66 |
|
67 protected: // from CActive |
|
68 |
|
69 void DoCancel(); |
|
70 void RunL(); |
|
71 |
|
72 public: // New methods |
|
73 |
|
74 /// Extends the lifetime of the client by iTimeout |
|
75 void NotYet(); |
|
76 |
|
77 private: // Data |
|
78 |
|
79 /// Handle to observed thread. |
|
80 RThread iClient; |
|
81 |
|
82 /// Life timeout |
|
83 TTimeIntervalMicroSeconds32 iTimeout; |
|
84 |
|
85 /// Timeout timer. Owned. |
|
86 RTimer iTimer; |
|
87 |
|
88 }; |
|
89 |
|
90 #endif // __CTCGRIMREAPER_H__ |