Skip to content

Commit

Permalink
Fix hClose002 with the threaded RTS IO manager
Browse files Browse the repository at this point in the history
If 'close fd' failed, then the MVars in the callbackTables would be
left empty, which caused deadlocks when we tried to 'take' them again.

Now we use 'finally' to ensure that they are refilled even if 'close'
throws an exception.
  • Loading branch information
Ian Lynagh committed Jun 16, 2013
1 parent 9afb928 commit 80b02b2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions GHC/Event/Thread.hs
Expand Up @@ -103,8 +103,7 @@ closeFdWith close fd = do
(\mgr table -> M.closeFd_ mgr table fd)
mgrs
tables
close fd
zipWithM_ finish mgrs tableAndCbApps
close fd `finally` zipWithM_ finish mgrs tableAndCbApps
where
finish mgr (table', cbApp) = do
putMVar (M.callbackTableVar mgr fd) table'
Expand Down

0 comments on commit 80b02b2

Please sign in to comment.