From 6e46cc84fbd94abd0c44f8ca3309f6ddf8c1ce8d Mon Sep 17 00:00:00 2001 From: Teo Camarasu Date: Wed, 17 Dec 2025 17:07:21 +0000 Subject: [PATCH] Make atomicModifyStrip strict Previously we could end up with thunks in our mutable variable --- thread-utils-context/src/Control/Concurrent/Thread/Storage.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thread-utils-context/src/Control/Concurrent/Thread/Storage.hs b/thread-utils-context/src/Control/Concurrent/Thread/Storage.hs index 8020593..70fae2c 100644 --- a/thread-utils-context/src/Control/Concurrent/Thread/Storage.hs +++ b/thread-utils-context/src/Control/Concurrent/Thread/Storage.hs @@ -98,7 +98,7 @@ atomicModifyStripe (ThreadStorageMap arr#) tid f = IO $ \s -> go s let (updatedIntMap, result) = f intMap in case casArray# arr# stripe# intMap updatedIntMap s1 of (# s2, outcome, old #) -> case outcome of - 0# -> (# s2, result #) + 0# -> updatedIntMap `seq` (# s2, result #) 1# -> go s2 _ -> error "Got impossible result in atomicModifyStripe"