[Haskell-cafe] turn off "thread blocked indefinitely in an STM transaction"?

Roman Cheplyaka roma at ro-che.info
Tue Nov 17 12:15:41 UTC 2015


On 11/17/2015 02:06 PM, Johannes Waldmann wrote:
> Ah, neat. I get the idea. But does it work here?
> 
> import Control.Concurrent.STM
> import Foreign.StablePtr
> main =  atomically retry >>= newStablePtr
> 
> ghc -threaded -rtsopts -O2 sp.hs
> 
> ./sp +RTS -N
> sp: thread blocked indefinitely in an STM transaction


StablePtr needs to contain the ThreadId of the current thread.

  myThreadId >>= newStablePtr
  atomically retry

In your example, newStablePtr won't even be called until retry has been
interrupted.

Roman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151117/1e875db0/attachment.sig>


More information about the Haskell-Cafe mailing list