1 /* |
|
2 * Copyright (c) 2002-2005 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: Monitors threads death and notifies an event, when thread dies |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSATTHREADDEATHMONITOR_H |
|
21 #define CSATTHREADDEATHMONITOR_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MThreadDeathObserver; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * Monitors thread deaths and notifies an event, when one dies |
|
32 * |
|
33 * @lib SatEngine.lib |
|
34 * @since Series 60 2.6 |
|
35 */ |
|
36 class CSatThreadDeathMonitor : public CActive |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * @param aUtils Utils API for event notify |
|
43 */ |
|
44 static CSatThreadDeathMonitor* NewL(); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CSatThreadDeathMonitor(); |
|
50 |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * Notfifies the observer, when thread dies. Cancels outstanding |
|
55 * thread death notification, if one exists. |
|
56 * @param aThreadId Id of thread. |
|
57 * @param aObserver Observer of the thread death |
|
58 */ |
|
59 void NotifyThreadDeathL( |
|
60 const TThreadId& aThreadId, |
|
61 MThreadDeathObserver& aObserver ); |
|
62 |
|
63 protected: // New functions |
|
64 |
|
65 /** |
|
66 * Issues the request of thread death. |
|
67 */ |
|
68 void StartObservingThreadDeath(); |
|
69 |
|
70 protected: // Functions from base classes |
|
71 |
|
72 /** |
|
73 * From CActive |
|
74 */ |
|
75 void DoCancel(); |
|
76 |
|
77 /** |
|
78 * From CActive |
|
79 */ |
|
80 void RunL(); |
|
81 |
|
82 private: |
|
83 |
|
84 /** |
|
85 * C++ default constructor. |
|
86 */ |
|
87 CSatThreadDeathMonitor(); |
|
88 |
|
89 private: // Data |
|
90 |
|
91 // Thread that is monitored |
|
92 RThread iThread; |
|
93 |
|
94 // Observer for thread death. |
|
95 MThreadDeathObserver* iObserver; |
|
96 |
|
97 }; |
|
98 |
|
99 #endif // CSATTHREADDEATHMONITOR_H |
|
100 |
|
101 // End of File |
|