aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwatchdog.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:50 -0500
committerJacek Antonelli2008-08-15 23:45:50 -0500
commit2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch)
tree95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llwatchdog.h
parentSecond Life viewer sources 1.20.6 (diff)
downloadmeta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/newview/llwatchdog.h')
-rw-r--r--linden/indra/newview/llwatchdog.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/linden/indra/newview/llwatchdog.h b/linden/indra/newview/llwatchdog.h
new file mode 100644
index 0000000..96388bb
--- /dev/null
+++ b/linden/indra/newview/llwatchdog.h
@@ -0,0 +1,98 @@
1/**
2 * @file llthreadwatchdog.h
3 * @brief The LLThreadWatchdog class declaration
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LL_LLTHREADWATCHDOG_H
33#define LL_LLTHREADWATCHDOG_H
34
35#ifndef LL_TIMER_H
36 #include "lltimer.h"
37#endif
38
39// LLWatchdogEntry is the interface used by the tasks that
40// need to be watched.
41class LLWatchdogEntry
42{
43public:
44 LLWatchdogEntry();
45 virtual ~LLWatchdogEntry();
46
47 // isAlive is accessed by the watchdog thread.
48 // This may mean that resources used by
49 // isAlive and other method may need synchronization.
50 virtual bool isAlive() const = 0;
51 virtual void start();
52 virtual void stop();
53};
54
55class LLWatchdogTimeout : public LLWatchdogEntry
56{
57public:
58 LLWatchdogTimeout();
59 virtual ~LLWatchdogTimeout();
60
61 /* virtual */ bool isAlive() const;
62 /* virtual */ void start();
63 /* virtual */ void stop();
64
65 void setTimeout(F32 d);
66 void ping();
67
68private:
69 LLTimer mTimer;
70 F32 mTimeout;
71};
72
73class LLWatchdogTimerThread; // Defined in the cpp
74class LLWatchdog : public LLSingleton<LLWatchdog>
75{
76public:
77 LLWatchdog();
78 ~LLWatchdog();
79
80 // Add an entry to the watchdog.
81 void add(LLWatchdogEntry* e);
82 void remove(LLWatchdogEntry* e);
83
84 void init();
85 void run();
86 void cleanup();
87
88private:
89 void lockThread();
90 void unlockThread();
91
92 typedef std::set<LLWatchdogEntry*> SuspectsRegistry;
93 SuspectsRegistry mSuspects;
94 LLMutex* mSuspectsAccessMutex;
95 LLWatchdogTimerThread* mTimer;
96};
97
98#endif // LL_LLTHREADWATCHDOG_H