Last change
on this file since 48 was
48,
checked in by wcaarls, 11 years ago
|
Imported shared_serial at revision 2117
|
File size:
572 bytes
|
Line | |
---|
1 | #ifndef __SS_WATCHDOG_H |
---|
2 | #define __SS_WATCHDOG_H |
---|
3 | |
---|
4 | #include <pthread.h> |
---|
5 | |
---|
6 | class WatchdogThread |
---|
7 | { |
---|
8 | protected: |
---|
9 | pthread_t thread_; |
---|
10 | pthread_mutex_t mutex_; |
---|
11 | double interval_; |
---|
12 | bool kicked_, set_; |
---|
13 | |
---|
14 | public: |
---|
15 | WatchdogThread() : set_(false) { } |
---|
16 | WatchdogThread(double interval) : set_(false) { set(interval); } |
---|
17 | virtual ~WatchdogThread(); |
---|
18 | |
---|
19 | bool set(double interval); |
---|
20 | bool kick(); |
---|
21 | |
---|
22 | protected: |
---|
23 | virtual void watch(); |
---|
24 | virtual void bark(); |
---|
25 | |
---|
26 | private: |
---|
27 | static void *watchDelegate(void *obj); |
---|
28 | }; |
---|
29 | |
---|
30 | #endif /* __SS_WATCHDOG_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.