aboutsummaryrefslogtreecommitdiff
path: root/zencore/thread.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-01-07 10:12:48 +0100
committerMartin Ridgers <[email protected]>2022-01-07 10:16:52 +0100
commit9ea8768c0799a1670966e41d37fe01f39eccd5bc (patch)
treef3374fefc511dc1a18a3872931418fa6680a7672 /zencore/thread.cpp
parentCorrected misleading comment (diff)
downloadzen-9ea8768c0799a1670966e41d37fe01f39eccd5bc.tar.xz
zen-9ea8768c0799a1670966e41d37fe01f39eccd5bc.zip
Timeouts longer than one second wouldn't work as expected
Diffstat (limited to 'zencore/thread.cpp')
-rw-r--r--zencore/thread.cpp4
1 files changed, 2 insertions, 2 deletions
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;