#5797: readRawBufferPtr cannot be interrupted by exception on Windows with
-threaded
-------------------------------+--------------------------------------------
    Reporter:  joeyadams       |       Owner:                             
        Type:  bug             |      Status:  new                        
    Priority:  normal          |   Milestone:                             
   Component:  libraries/base  |     Version:  7.2.2                      
    Keywords:                  |          Os:  Windows                    
Architecture:  x86             |     Failure:  Incorrect result at runtime
  Difficulty:  Unknown         |    Testcase:                             
   Blockedby:                  |    Blocking:                             
     Related:                  |  
-------------------------------+--------------------------------------------

Comment(by simonmar):

 No, `threadWaitRead` is not implemented on Windows with `-threaded`.

 You can use a simple Async wrapper:

 {{{
 data Async a = Async (MVar a)

 async :: IO a -> IO (Async a)
 async action = do
    var <- newEmptyMVar
    forkIO (action >>= putMVar var)
    return (Async var)

 wait :: Async a -> IO a
 wait (Async var) = readMVar var
 }}}

 the problem here is that cancelling the `wait` call will not cancel the
 actual IO operation.  That might not matter, depending on the details of
 your particular situation.  FWIW, this is what happens in the non-threaded
 RTS, except that the behaviour is built into the RTS.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5797#comment:3>
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

Reply via email to