[Haskell-cafe] Relaxing atomicity of STM transactions

Peter Robinson thaldyron at gmail.com
Tue Sep 28 09:41:27 EDT 2010

On 28 September 2010 15:35, Tom Hawkins <tomahawkins at gmail.com> wrote:
> Has anyone in the STM community considered the ability to read a TVar,
> such that it would allow the transaction to complete even if the TVar
> was modified by another transaction?

Maybe something like this:
(Pasted from http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-
readTVarIO :: TVar a -> IO a
Return the current value stored in a TVar. This is equivalent to
  readTVarIO = atomically . readTVar
but works much faster, because it doesn't perform a complete
transaction, it just reads the current value of the TVar.


> (I am assuming this is not how
> STM works by default.)  For example:
> looselyReadTVar :: TVar a -> STM a
> Atom [1] has similar semantics to STM.  If Atom were to relax it's
> rule atomicity in this fashion, it could open the door to improved
> task scheduling and higher levels of program description.  Has STM
> research already gone down this path?
> -Tom
> [1] http://hackage.haskell.org/package/atom
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list