[Haskell-cafe] Efficient mutable arrays in STM

Alberto G. Corona agocorona at gmail.com
Thu Oct 27 20:58:05 CEST 2011

> The main question is: does the STM transaction actually "see" that I
> changed
> part of the underlying array, so that the transaction gets re-tried? Or do
> I
> have to implement this manually, and if yes: how?
The transaction does not detect anything inside the unsafeIOtoSTM.  But to
implement this manually is  simple: use "retry" whenever you need to retry
the local  transaction. if the affected transactions are more than the local
trnasaction, create an special TVar to be inspected by all of them. for
example  doesTheArrayHasChanged :: TVar Bool.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111027/c6783478/attachment.htm>

More information about the Haskell-Cafe mailing list