@@ -32,7 +32,7 @@ module Streamly.Internal.Data.IORef.Unboxed
3232
3333 -- Read
3434 , readIORef
35− , toStreamD
35+ , pollIntIORef
3636 )
3737where
3838
@@ -87,10 +87,16 @@ modifyIORef' var g = do
8787
8888-- | Generate a stream by continuously reading the IORef.
8989--
90+-- This operation reads the IORef without any synchronization. It can be
91+-- assumed to be atomic because the IORef (MutableByteArray) is always aligned
92+-- to Int boundaries, we are assuming that compiler uses single instructions to
93+-- access the memory. It may read stale values though until caches are
94+-- synchronised in a multiprocessor architecture.
95+--
9096-- /Pre-release/
91−{-# INLINE_NORMAL toStreamD #-}
92−toStreamD :: (MonadIO m, Unbox a) => IORef a -> D.Stream m a
93−toStreamD var = D.Stream step ()
97+{-# INLINE_NORMAL pollIntIORef #-}
98+pollIntIORef :: (MonadIO m, Unbox a) => IORef a -> D.Stream m a
99+pollIntIORef var = D.Stream step ()
94100
95101 where
96102