[GHC] #12547: Concurrent.ForeignPtr needs to access a C-ForeignPtr, but this is already gone

GHC ghc-devs at haskell.org
Mon Aug 29 07:45:44 UTC 2016


#12547: Concurrent.ForeignPtr needs to access a C-ForeignPtr, but this is already
gone
-------------------------------------+-------------------------------------
        Reporter:  Lemming           |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Runtime System    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonmar):

 * type:  bug => feature request


Comment:

 Currently all `ForeignPtrs` that are unreachable get finalized at the same
 time.  This is how it's intended to work.

 We *could* refine it so that a finalizer from a `Concurrent.ForeignPtr`
 can keep a C `ForeignPtr` alive.  It would mean processing the two kinds
 of weak pointers in separate batches (and possibly keeping them in
 separate lists, I'm not sure).

 Note that this is a special case, and is different from saying that a
 finalizer from any dead `ForeignPtr` can keep any other `ForeignPtr`
 alive.  It's not clear to me how you'd define a sensible semantics in that
 case (consider a `ForeignPtr` that refers to itself from its finalizer, or
 two `ForeignPtr`s that refer to each other from their finalizers).

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


More information about the ghc-tickets mailing list