AWatchdog#
Watchdog helper class.
Header: | #include <AUI/Util/AWatchdog.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Detailed Description#
Watchdog is either hardware or software (as in this case) module which detects hangs of subject (in this case, of a callback).
AWatchdog catches ANR (Application Not Responsive) errors in GUI AUI applications.
It's important to periodically call AWatchdog::isHang in order to check for hangs. It can be done via separate thread or AUI's timers (separate thread is more reliable).
Public Methods#
AWatchdog#
AWatchdog::AWatchdog(std::chrono::high_resolution_clock::duration hangDuration = std::chrono::seconds(10))
- Arguments
hangDuration
the time frame exceeding which considered as hang.
isHang#
Checks for hang state.
- Returns
- true, if runOperation exceeded mHangDuration.
runOperation#
Runs callback which is subject to check for hangs.
If execution time of operation exceeds mHangDuration, the operation is considered hang and AWatchdog::isHang would report hang state when AWatchdog::isHang is called.