Browse thread
Custom blocks and finalization
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-05-01 (16:00) |
From: | Markus Mottl <markus.mottl@g...> |
Subject: | Re: [Caml-list] Custom blocks and finalization |
On Fri, May 1, 2009 at 10:18, Dr. Thomas Fischbacher <t.fischbacher@soton.ac.uk> > Can you provide some more information on the low level > details about this issue? E.g. can it arise in non-threaded > OCaml code? Yes, if your C-finalizer e.g. needs to remove global roots, this may not be sound. I am not totally sure this is actually true in the current implementation, but at least the documentation clearly indicates that any interaction with the OCaml-runtime from within C-finalizers is prohibited. You may essentially just extract C-values / pointers from the OCaml-value to be reclaimed and manipulate those. > If there is any way to get this resolved by e.g. introducing > another set of C-level functions within OCaml and asking > people to switch over to using those, I would consider > that the most appropriate way forward. It's my superficial impression that the runtime system could be fixed such that interactions with it from within C-finalizers and other custom functions becomes safe, maybe at the expense of some performance. E.g. if you register finalizers with the Gc-module from within OCaml, it seems that the runtime first records all finalizer functions that need to be called after a collection in a table. Maybe something similar can be done for C-finalizers? Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com