From 9ea8768c0799a1670966e41d37fe01f39eccd5bc Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Fri, 7 Jan 2022 10:12:48 +0100 Subject: Timeouts longer than one second wouldn't work as expected --- zencore/thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'zencore/thread.cpp') diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 0a6af0406..fc7efa2fc 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -373,8 +373,8 @@ NamedEvent::Wait(int TimeoutMs) } struct timeval TimeoutValue = { - .tv_sec = 0, - .tv_usec = TimeoutMs << 10, + .tv_sec = (TimeoutMs >> 10), + .tv_usec = (TimeoutMs & 0x3ff) << 10, }; struct timeval* TimeoutPtr = (TimeoutMs < 0) ? nullptr : &TimeoutValue; -- cgit v1.2.3