#7353: Make system IO interruptible on Windows
---------------------------------+------------------------------------------
    Reporter:  joeyadams         |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Milestone:  7.8.1                      
   Component:  libraries/base    |     Version:  7.6.1                      
    Keywords:                    |          Os:  Windows                    
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
  Difficulty:  Unknown           |    Testcase:                             
   Blockedby:                    |    Blocking:                             
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonmar):

 Ah, well done for finding the winio package - I was looking for it earlier
 but couldn't remember what it was called or who the author was.

 So I think your design involves a single IO manager thread and a pool of
 worker OS threads to start/cancel each IO request, right?  While this
 would work, I think it not ideal, because you'll need one OS thread for
 each in-progress IO operation, since all of these OS threads are blocked
 in the `(Ptr OVERLAPPED -> IO ())` function waiting for the result.

 Perhaps instead make the IO manager itself a bound thread, and perform all
 the start and cancel operations on the IO manager thread.  Then an IO
 request is performed by sending the IO manager a pair: `(start, MVar
 Completion)`, where `start` is the operation to start the IO and the MVar
 signals completion.  The calling thread would block on the `MVar` inside a
 `catch`, where the exception handler tells the IO manager to cancel the IO
 by passing it a `cancel` action.

 I suppose in general you will need multiple IO manager threads, to avoid
 the problem with `CancelIo` cancelling all the pending IO associated with
 a given HANDLE.  We expect it to be rare to have multiple outstanding IO
 requests on the same HANDLE though - maybe you could even make it an
 error.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7353#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to