From 2e36a9401c3540fc340fb83e11bb1b196652e8a0 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Tue, 18 Feb 2025 12:51:46 +0300 Subject: [PATCH] busyloop candidate --- hbs2-core/lib/HBS2/Polling.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hbs2-core/lib/HBS2/Polling.hs b/hbs2-core/lib/HBS2/Polling.hs index 6da532e8..c0588ba7 100644 --- a/hbs2-core/lib/HBS2/Polling.hs +++ b/hbs2-core/lib/HBS2/Polling.hs @@ -23,6 +23,8 @@ polling :: forall a m . (MonadIO m, Hashable a) polling o listEntries action = do + let tsMin = toTimeSpec (TimeoutSec 0.01) + -- FIXME: might-be-concurrent pause (TimeoutNDT (waitBefore o)) @@ -48,7 +50,7 @@ polling o listEntries action = do next (HashMap.delete r mon') Just (Entry t _, _) | otherwise -> do - pause (TimeoutTS (t - now)) + pause (max (TimeoutTS tsMin) (TimeoutTS (t - now))) next mon' Nothing -> do