AUI Framework
develop
Cross-platform base for C++ UI apps
|
Watchdog helper class. More...
#include <AUI/Util/AWatchdog.h>
Public Member Functions | |
AWatchdog (std::chrono::high_resolution_clock::duration hangDuration=std::chrono::seconds(10)) | |
template<aui::invocable Operation> | |
auto | runOperation (Operation &&operation) -> decltype(operation()) |
Runs callback which is subject to check for hangs. | |
bool | isHang () const noexcept |
Checks for hang state. | |
Watchdog helper class.
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).
|
inline |
hangDuration | the time frame exceeding which considered as hang. |
|
nodiscardnoexcept |
Checks for hang state.
|
inline |
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.