14#include <AUI/Common/AObject.h>
17#include "AUI/Common/AOptional.h"
18#include "AUI/Thread/AMutex.h"
19#include "AUI/Traits/concepts.h"
20#include "AUI/Util/ARaiiHelper.h"
21#include "AUI/Util/kAUI.h"
43 AWatchdog(std::chrono::high_resolution_clock::duration hangDuration = std::chrono::seconds(10)): mHangDuration(hangDuration) {}
51 template<aui::invocable Operation>
52 auto runOperation(Operation&& operation) ->
decltype(operation()) {
53 std::unique_lock lock(mSync);
54 mBeginPoint = std::chrono::high_resolution_clock::now();
68 bool isHang() const noexcept;
72 std::chrono::high_resolution_clock::duration mHangDuration;
73 AOptional<std::chrono::high_resolution_clock::time_point> mBeginPoint;
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:32
auto runOperation(Operation &&operation) -> decltype(operation())
Runs callback which is subject to check for hangs.
Definition AWatchdog.h:52
AWatchdog(std::chrono::high_resolution_clock::duration hangDuration=std::chrono::seconds(10))
Definition AWatchdog.h:43
#define AUI_DEFER
Defers execution of the next block to the end of current block (RAII scope).
Definition kAUI.h:196
Basic syscall-based synchronization primitive.
Definition AMutex.h:33