[GHC] #8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation.

#8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation. -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: task | Status: new Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Documentation Difficulty: Easy (less than 1 | bug hour) | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- We just discussed the following code on #ghc. {{{ import System.IO.Unsafe import Control.Concurrent.MVar import Control.Concurrent import GHC.Conc (par, pseq) x :: MVar Int -> Int -> Int x m a = unsafeDupablePerformIO $ withMVar m $ \i -> do sum [1..1000000 + a] `seq` return i main1 = do m <- newMVar 42 let w = x m 0 w `par` print w {- spark: thread blocked indefinitely in an MVar operation -} main2 = do m <- newMVar 42 let w = x m 0 forkIO $ print w forkIO $ print w print w {- spark: <<loop>> spark: <<loop>> -} main = main2 }}} This is not a bug; what happens is that the RTS suspends one of the duplicated computations of {{{w}}}, effectively killing the IO action that was passed to {{{unsafeDupablePerformIO}}} in the middle. This limitation of {{{unsafeDupablePerformIO}}} should be documented. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8502 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation. -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: task | Status: new Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Documentation | Difficulty: Easy (less than 1 bug | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by int-e): The same limitation applies to {{{unsafeIOToST}}}, which is currently completely undocumented. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8502#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation. -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: task | Status: new Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Documentation | Difficulty: Easy (less than 1 bug | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by simonmar): * cc: simonmar (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8502#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation. -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: task | Status: patch Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Documentation | Difficulty: Easy (less than 1 bug | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by int-e): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8502#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8502: Document a surprising {{{unsafeDupablePerformIO}}} limitation. -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: task | Status: closed Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Documentation | Difficulty: Easy (less than 1 bug | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged, thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8502#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC