[stm] strange behavior with TQueue and STM's alternative instance
Simon Marlow
marlowsd at gmail.com
Mon Dec 10 15:20:56 CET 2012
On 10/12/12 13:24, Bas van Dijk wrote:
> import Control.Concurrent.STM
> main = do
> x <- atomically $ do
> t <- newTVar 1
> writeTVar t 2
> ((writeTVar t 3 >> retry) `orElse` return ()) `orElse` return ()
> readTVar t
> print x
Yes, it gives the right answer now. I don't think reading or writing in
the inner transaction affects the bug, since that part is aborted before
we get to the outer orElse, which is where the erroneous case was triggered.
Cheers,
Simon
More information about the Libraries
mailing list