Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: "Dr. Thomas Fischbacher" <t.fischbacher@soton.ac.uk>
Cc: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Custom blocks and finalization
Date: Fri, 1 May 2009 12:00:56 -0400	[thread overview]
Message-ID: <f8560b80905010900g6459388arc5c2be98059c980c@mail.gmail.com> (raw)
In-Reply-To: <49FB04A9.3090008@soton.ac.uk>

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


  parent reply	other threads:[~2009-05-01 16:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 15:46 Markus Mottl
2009-04-30 18:17 ` [Caml-list] " Dr. Thomas Fischbacher
     [not found] ` <49FB04A9.3090008@soton.ac.uk>
2009-05-01 16:00   ` Markus Mottl [this message]
2009-05-06 16:30     ` Dr. Thomas Fischbacher
2009-05-06 16:54       ` Markus Mottl
2009-05-06 17:53         ` Dr. Thomas Fischbacher
2009-05-08  9:36         ` Xavier Leroy
2009-05-08 13:48           ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8560b80905010900g6459388arc5c2be98059c980c@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=t.fischbacher@soton.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox