AUI Framework
master
Cross-platform module-based framework for developing C++20 desktop applications
|
Watchdog helper class. More...
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).
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. More... | |
bool | isHang () const noexcept |
Checks for hang state. More... | |
|
inline |
hangDuration | the time frame exceeding which considered as hang. |
|
noexcept |
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.
#include <AUI/Util/AWatchdog.h>