#4329: GHC.Conc modifyTVar primitive
---------------------------------+------------------------------------------
Reporter: dmbarbour | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 6.12.3 | Keywords: TVar, STM, modifyTVar,
Concurrency
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
I would like modifyTVar as a 'write-only' primitive supported by GHC's
STM.
The semantic definition is:
> modifyTVar :: TVar a -> (a -> a) -> STM ()
> modifyTVar v f = readTVar v >>= writeTVar v . f
However, explicitly reading then writing the TVar introduces unnecessary
interference between transactions. The value held by the TVar does not
affect the behavior of the transaction. modifyTVar should not interfere
with other transactions that only writeTVar or modifyTVar.
Even if a non-interfering implementation isn't feasible due to the
underlying implementation of GHC's STM, providing the function would
provide a point for a transparent upgrade in the future.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4329>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs