streamly-core-0.1.0: Streaming, parsers, arrays and more
Copyright(c) 2019 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.IORef.Unboxed

Description

A mutable variable in a mutation capable monad (IO) holding a Unboxed value. This allows fast modification because of unboxed storage.

Multithread Consistency Notes

In general, any value that straddles a machine word cannot be guaranteed to be consistently read from another thread without a lock. GHC heap objects are always machine word aligned, therefore, a IORef is also word aligned. On a 64-bit platform, writing a 64-bit aligned type from one thread and reading it from another thread should give consistent old or new value. The same holds true for 32-bit values on a 32-bit platform.

Synopsis

Documentation

data IORef a Source #

An IORef holds a single Unbox-able value.

Construction

newIORef :: forall a. Unbox a => a -> IO (IORef a) Source #

Create a new IORef.

Pre-release

Write

writeIORef :: Unbox a => IORef a -> a -> IO () Source #

Write a value to an IORef.

Pre-release

modifyIORef' :: Unbox a => IORef a -> (a -> a) -> IO () Source #

Modify the value of an IORef using a function with strict application.

Pre-release

Read

readIORef :: Unbox a => IORef a -> IO a Source #

Read a value from an IORef.

Pre-release

toStreamD :: (MonadIO m, Unbox a) => IORef a -> Stream m a Source #

Generate a stream by continuously reading the IORef.

Pre-release