|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined (__THREADWATCH_H__) |
|
17 #define __THREADWATCH_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 //Forward declaration |
|
22 class CStarter; |
|
23 |
|
24 class CThreadWatcher : public CActive |
|
25 { |
|
26 public: |
|
27 /** |
|
28 * Creates an instance of an Thread Watcher. |
|
29 * |
|
30 * @param aThreadId id of the thread to be monitored |
|
31 * @param aCallBack Callback to be called on thread exit |
|
32 * @return a pointer to this object |
|
33 */ |
|
34 static CThreadWatcher* NewL(TInt appType, const TThreadId aThreadId, TFullName fileName, CStarter* aOwner, TUint32 aAppUid, TBool aViewless); |
|
35 |
|
36 /** |
|
37 * Destructor. |
|
38 */ |
|
39 ~CThreadWatcher(); |
|
40 |
|
41 private: |
|
42 /** |
|
43 * Method called when the thread exit |
|
44 */ |
|
45 void RunL(); |
|
46 |
|
47 /** |
|
48 * Cancel the current monitoring |
|
49 */ |
|
50 void DoCancel(); |
|
51 |
|
52 /** |
|
53 * Restart the thread |
|
54 */ |
|
55 void RestartThreadL(); |
|
56 |
|
57 /** |
|
58 * Contructor |
|
59 */ |
|
60 CThreadWatcher(TInt appType, TFullName aFullName, CStarter* aOwner, TUint32 aAppUid, TBool aViewless); |
|
61 |
|
62 /** |
|
63 * Handles the actual initialization of this object. |
|
64 * @param aThreadId id of the thread to be monitored |
|
65 */ |
|
66 void ConstructL(const TThreadId aThreadId); |
|
67 |
|
68 private: |
|
69 TInt iAppType; |
|
70 RThread iThread; // thread monitored |
|
71 TBool iMonitoringThread; // |
|
72 TFullName iFullName; |
|
73 CStarter* iOwner; |
|
74 TUint32 iAppUid; |
|
75 TBool iViewless; |
|
76 |
|
77 |
|
78 public: |
|
79 TSglQueLink iLink; // Linked list anchor |
|
80 }; |
|
81 |
|
82 #endif |