on master help sign in
Fix slidingWindow
commitb209502024b86bef9b54bded35cf02b07e0a2384 authorAnurag Hooda <anuraghooda@composewell.com> dateMon 27 Dec 2021, 09:19 (5 years ago) parent08f82ab
1 file changed+2
src/Streamly/Internal/Data/Ring/Foreign.hs+2
src/Streamly/Internal/Data/Ring/Foreign.hs+2
@@ -538,6 +538,7 @@ slidingWindow n (Fold step1 initial1 extract1)= Fold step initial extract
538538 step (Tuple4' rb rh i st) a
539539 | i < n = do
540540 rh1 <- liftIO $ unsafeInsert rb rh a
541+ liftIO $ touchForeignPtr (ringStart rb)
541542 r <- step1 st (a, Nothing)
542543 return $
543544 case r of
@@ -546,6 +547,7 @@ slidingWindow n (Fold step1 initial1 extract1)= Fold step initial extract
546547 | otherwise = do
547548 old <- liftIO $ peek rh
548549 rh1 <- liftIO $ unsafeInsert rb rh a
550+ liftIO $ touchForeignPtr (ringStart rb)
549551 r <- step1 st (a, Just old)
550552 return $
551553 case r of