#2560: killThread and getChanContents appear to interact strangely
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |        Owner:                  
        Type:  bug               |       Status:  closed          
    Priority:  normal            |    Milestone:  6.10.2          
   Component:  Runtime System    |      Version:  6.9             
    Severity:  normal            |   Resolution:  invalid         
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 I've spent a long time staring at this ticket today, and I'm not convinced
 there's a bug.  `modifyMVar` is exception-safe, and so is
 `getChanContents`, as far as I can tell.  Ian's point is true, that you
 can't guarantee to keep exceptions blocked when calling a library
 function, but I don't think that makes anything unsafe in this case.
 Exception-safety is all about making sure that `MVars` get replaced if an
 exception is raised, and I think that always holds for `modifyMVar` and
 `getChanContents`.

 No, I suspect there's a bug in the program logic.  It just loops when it
 gets to a chunk size of 1, and if you look at the definition of
 `readWithTimeout`, you can see why.  If the chunk size is 1, it just
 recurses with the same value for `n`.  At least, that's my guess - I don't
 fully understand what this program is trying to do.

 If you disagree, plesae re-open the bug.

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