#1364: Finalizers not guaranteed to run before the program exits
----------------------------------+-----------------------------------------
 Reporter:  [EMAIL PROTECTED]  |          Owner:  simonmar        
     Type:  feature request       |         Status:  new             
 Priority:  normal                |      Milestone:  6.10.1          
Component:  Runtime System        |        Version:  6.6.1           
 Severity:  normal                |     Resolution:                  
 Keywords:                        |     Difficulty:  Moderate (1 day)
 Testcase:                        |   Architecture:  Unknown         
       Os:  Unknown               |  
----------------------------------+-----------------------------------------
Comment (by simonmar):

 Perhaps I'm reading the code wrong, but it seems that you'll get two weak
 pointers created by a `newForeignPtr`: one created by
 `addForeignPtrFinalizer` and one created by  `addForeignPtrConcFinalizer`
 (which is called by `addForeignPtrFinalizer`).  Also, the weak pointer
 with the C finalizer should be attached to the `MutVar#` inside the IORef,
 in the same way that `addForeignPtrConcFinalizer` does (this is a safety
 measure, because the compiler might optimise away `ForeignPtrContents`,
 but it can't optimise away a `MutVar#`).

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