From 2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 7 Sep 2022 00:40:26 +0200 Subject: Improve error handling. --- c/data.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'c/data.cpp') diff --git a/c/data.cpp b/c/data.cpp index a75111a..32e059f 100644 --- a/c/data.cpp +++ b/c/data.cpp @@ -118,7 +118,7 @@ void WaitFor(Window& window, void (*f)(unsigned char*)) static auto procThread = [](void (*f)(unsigned char*)) noexcept -> void { - SET_TERMINATE; + std::set_terminate(OnTerminate); while (!(sig & READY)) Sleep(100); sig = 0; @@ -152,7 +152,8 @@ void WaitFor(Window& window, void (*f)(unsigned char*)) s_window = &window; std::thread(procThread, f).detach(); s_window->Status(L".", 1); - Prefer(iTimer = SetTimer(nullptr, iTimer, 500, procTimer)); + if (!(iTimer = SetTimer(nullptr, iTimer, 500, procTimer))) + throw Err(WINDOWS, L"Timer could not be started: %s"); } void FetchData(unsigned char* sig) -- cgit v1.2.3