1 #ifndef GAUDIKERNEL_WATCHDOGTHREAD_H_
2 #define GAUDIKERNEL_WATCHDOGTHREAD_H_
6 #include <boost/date_time/posix_time/posix_time_types.hpp>
7 #include <boost/thread/thread_time.hpp>
8 #include <boost/thread/mutex.hpp>
11 #include "GaudiKernel/Kernel.h"
14 namespace boost {
class thread; }
31 WatchdogThread(boost::posix_time::time_duration timeout,
bool autostart =
false);
45 boost::mutex::scoped_lock
lock(m_lastPingMutex);
46 m_lastPing = boost::get_system_time();
51 inline void setTimeout(boost::posix_time::time_duration timeout) {
56 inline boost::posix_time::time_duration getTimeout()
const {
61 inline boost::system_time getLastPing()
const {
62 boost::mutex::scoped_lock
lock(m_lastPingMutex);
71 virtual void onPing();
74 virtual void onStart();
77 virtual void onStop();
81 boost::posix_time::time_duration m_timeout;
84 boost::system_time m_lastPing;
87 std::auto_ptr<boost::thread> m_thread;
98 mutable boost::mutex m_lastPingMutex;
Simple class for asynchronous check of time-out.