------------------------------------------------------------------------------- |-- Module : Control.Concurrent.SHFSTM.Internal.TransactionLog-- Copyright : (c) D. Sabel, Goethe-University, Frankfurt a.M., Germany-- License : BSD-style -- -- Maintainer : sabel <at> ki.cs.uni-frankfurt.de-- Stability : experimental-- Portability : non-portable (needs GHC and extensions)---- -- This module implements the transaction log-----------------------------------------------------------------------------module Control.Concurrent.STM.Internal.TransactionLog ( TLOG(..), Log(..), emptyTLOG ) whereimport Control.Concurrent.STM.Internal.TVar import Control.Concurrent.STM.Internal.Set as Setimport Data.IORef -- | The transaction log 'TLOG' of a thread-- for easy updates it is packed into a pointernewtype TLOG = TLOG (IORef Log)-- | The 'Log' stores several lists -- it only stores 'TVarAny'sdata Log = Log { -- | List T, the read TVars readTVars :: Set TVarAny -- | A stack of tripels (La,Ln,Lw) where -- -- La = all local tvars, -- -- Ln = new local tvars, -- -- Lw = locally written TVars , tripelStack :: [(Set TVarAny, Set TVarAny,Set TVarAny)] -- | List K , lockingSet :: Set TVarAny } -- | 'emptyTLOG' constructs an empty transaction log of type 'TLOG'emptyTLOG :: IO TLOGemptyTLOG = do p <- newIORef (Log Set.empty [(Set.empty,Set.empty,Set.empty)] Set.empty) return (TLOG p)