
#13944: Introduce synchronized FFI -------------------------------------+------------------------------------- Reporter: winter | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | 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: | -------------------------------------+------------------------------------- Comment (by bgamari): I don't see how this could work (or I've misunderstood your proposal). Consider that you have a thread with some reference to some heap object (call it `A`) sitting in another capability's nursery. Let's say that it enters a `synchronized` call and while the call is running a GC is started. During this GC another other capability evacuates `A` (producing a new object, say `A'`) and the nursery in which it lived is freed. Now we have a situation where the thread who made the call has a reference to `A`, an object which existed in a no-longer-existing heap block, which it may attempt to dereference once the call completes. The distinguishing feature of the `safe` call mechanism is that we suspend the running thread, saving all of its state back to its TSO, where they can be handled by the garbage collector. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13944#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler