![]() |
The Gaudi Framework
v36r9 (fd2bdac3)
|
#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/WatchdogThread.h>

Public Member Functions | |
| WatchdogThread (boost::posix_time::time_duration timeout, bool autostart=false) | |
| Constructor. More... | |
| virtual | ~WatchdogThread () |
| Destructor. More... | |
| void | start () |
| Start the watchdog thread. More... | |
| void | stop () |
| Signal the watchdog thread to stop and wait for it. More... | |
| void | ping () |
| Function to call to notify the watchdog thread that we are still alive. More... | |
| void | setTimeout (boost::posix_time::time_duration timeout) |
| Change the duration of the time-out. More... | |
| boost::posix_time::time_duration | getTimeout () const |
| Get the current time-out value. More... | |
| boost::system_time | getLastPing () const |
| Get the time of latest ping. More... | |
Protected Member Functions | |
| virtual void | action () |
| User implemented function that will be called if the time-out is reached. More... | |
| virtual void | onPing () |
| User implemented function that will be called when ping is called. More... | |
| virtual void | onStart () |
| User implemented function that will be called when starting. More... | |
| virtual void | onStop () |
| User implemented function that will be called when stopping. More... | |
Private Member Functions | |
| void | i_run () |
| Core function of the secondary thread. More... | |
Private Attributes | |
| boost::posix_time::time_duration | m_timeout |
| Number of seconds allowed between pings. More... | |
| boost::system_time | m_lastPing |
| When the last ping was received. More... | |
| std::unique_ptr< boost::thread > | m_thread |
| Pointer to the running thread;. More... | |
| bool | m_running |
| Flag to mark the thread as running/stopped (avoid possible race conditions). More... | |
| std::mutex | m_lastPingMutex |
| Mutex for the access to the m_lastPing data member. More... | |
Simple class for asynchronous check of time-out.
The user must provide a callable with the action to be performed when the time-out occurs.
Definition at line 37 of file WatchdogThread.h.
| WatchdogThread::WatchdogThread | ( | boost::posix_time::time_duration | timeout, |
| bool | autostart = false |
||
| ) |
|
virtual |
Destructor.
Definition at line 28 of file WatchdogThread.cpp.
|
protectedvirtual |
User implemented function that will be called if the time-out is reached.
Definition at line 88 of file WatchdogThread.cpp.
|
inline |
Get the time of latest ping.
Definition at line 69 of file WatchdogThread.h.
|
inline |
|
private |
|
protectedvirtual |
User implemented function that will be called when ping is called.
Definition at line 91 of file WatchdogThread.cpp.
|
protectedvirtual |
User implemented function that will be called when starting.
Definition at line 94 of file WatchdogThread.cpp.
|
protectedvirtual |
User implemented function that will be called when stopping.
Definition at line 97 of file WatchdogThread.cpp.
|
inline |
Function to call to notify the watchdog thread that we are still alive.
Definition at line 56 of file WatchdogThread.h.
|
inline |
| void WatchdogThread::start | ( | ) |
| void WatchdogThread::stop | ( | ) |
Signal the watchdog thread to stop and wait for it.
Definition at line 45 of file WatchdogThread.cpp.
|
private |
When the last ping was received.
Definition at line 92 of file WatchdogThread.h.
|
mutableprivate |
Mutex for the access to the m_lastPing data member.
Definition at line 106 of file WatchdogThread.h.
|
private |
Flag to mark the thread as running/stopped (avoid possible race conditions).
Definition at line 98 of file WatchdogThread.h.
|
private |
Pointer to the running thread;.
Definition at line 95 of file WatchdogThread.h.
|
private |
Number of seconds allowed between pings.
Definition at line 89 of file WatchdogThread.h.