From 9f62b35a7380db253cce3310fa5208b8c8e20ef5 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 21 May 2021 21:17:12 +0200 Subject: Cleaned up exception handling We now use std::system_error where possible to report Win32 system errors. We still have WindowsException for general HRESULT based errors but we should phase it out where possible --- zencore/thread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'zencore/thread.cpp') diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 80cf6f100..4451fd302 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -58,13 +58,15 @@ Event::Reset() bool Event::Wait(int TimeoutMs) { + using namespace std::literals; + const DWORD Timeout = (TimeoutMs < 0) ? INFINITE : TimeoutMs; DWORD Result = WaitForSingleObject(m_EventHandle, Timeout); if (Result == WAIT_FAILED) { - throw WindowsException("Event wait failed"); + zen::ThrowLastError("Event wait failed"sv); } return (Result == WAIT_OBJECT_0); -- cgit v1.2.3