summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Conc/Windows.hs
diff options
context:
space:
mode:
authorBodigrim <andrew.lelechenko@gmail.com>2022-08-10 20:29:25 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-10 22:41:50 -0400
commit5c24b1b3a9d6a4c2f471fd7d8ec65141a8b46357 (patch)
treea9aca8e33c9df8b7ef701b033b245e5be7c758a0 /libraries/base/GHC/Conc/Windows.hs
parent45eb4cbe372eadb8331c6dbc84f14c681b1a8a9b (diff)
downloadhaskell-5c24b1b3a9d6a4c2f471fd7d8ec65141a8b46357.tar.gz
Document that threadDelay / timeout are susceptible to overflows on 32-bit machines
Diffstat (limited to 'libraries/base/GHC/Conc/Windows.hs')
-rw-r--r--libraries/base/GHC/Conc/Windows.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/libraries/base/GHC/Conc/Windows.hs b/libraries/base/GHC/Conc/Windows.hs
index fe452cbe32..50b91aaa45 100644
--- a/libraries/base/GHC/Conc/Windows.hs
+++ b/libraries/base/GHC/Conc/Windows.hs
@@ -95,12 +95,18 @@ asyncWriteBA fd isSock len off bufB =
-- when the delay has expired, but the thread will never continue to
-- run /earlier/ than specified.
--
+-- Be careful not to exceed @maxBound :: Int@, which on 32-bit machines is only
+-- 2147483647 μs, less than 36 minutes.
+--
threadDelay :: Int -> IO ()
threadDelay = POSIX.threadDelay <!> WINIO.threadDelay
-- | Set the value of returned TVar to True after a given number of
-- microseconds. The caveats associated with threadDelay also apply.
--
+-- Be careful not to exceed @maxBound :: Int@, which on 32-bit machines is only
+-- 2147483647 μs, less than 36 minutes.
+--
registerDelay :: Int -> IO (TVar Bool)
registerDelay = POSIX.registerDelay <!> WINIO.registerDelay