caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Quetzalcoatl Bradley <qbradley@blackfen.com>
To: caml-list@inria.fr
Subject: [Caml-list] Calling ocaml from external threads
Date: Wed, 27 Nov 2002 13:45:54 -0800	[thread overview]
Message-ID: <9AEA7798-0251-11D7-8AD6-003065AB3928@blackfen.com> (raw)
In-Reply-To: <20021127210431.GA1066@ice.gerd-stolpmann.de>


While the topic of threads is fresh...

Suppose you have an OCAML library (native code) to be embedded in a 
multithreaded C application.  The library is compiled with -output-obj 
unix.cmxa threads.cmxa and the C program calls caml_startup at the 
beginning.

Then I create a few C threads and they all call into the ocaml library 
occasionally.  before calling in they first leave_blocking_section, and 
afterwards they call leave_blocking_section.

At this point, The first time a call is made into the ocaml, 
Mutex.create is called, which crashes during a GC inside 
"oldify_local_roots".  Hash_retaddr(retaddr) is called, and the result 
looked up in the frame_descriptors table, but the result is a NULL 
pointer which crashes when dereferenced.

Is there anything special that needs to be done to "bless" external 
threads before they call into ocaml?

Unfortunately it isn't really feasible for me to have ocaml create all 
the threads and have the C code called from ocaml instead.  I presume 
that would be easier though.

Thanks,

Quetzalcoatl Bradley
qbradley@blackfen.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-11-28  9:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-23  9:08 [Caml-list] Why systhreads? Lauri Alanko
2002-11-24  7:36 ` Sven Luther
2002-11-24 17:41   ` Chris Hecker
2002-11-24 18:12     ` Basile STARYNKEVITCH
2002-11-24 21:10       ` Christopher Quinn
2002-11-24 17:14 ` Vitaly Lugovsky
2002-11-24 17:18   ` Lauri Alanko
2002-11-24 18:27   ` Dmitry Bely
2002-11-24 23:14     ` Vitaly Lugovsky
2002-11-27 14:33       ` Tim Freeman
2002-11-29 13:25         ` Vitaly Lugovsky
2002-11-25 10:01 ` Xavier Leroy
2002-11-25 14:20   ` Markus Mottl
2002-11-25 19:01   ` Blair Zajac
2002-11-25 21:06     ` james woodyatt
2002-11-25 22:20       ` Chris Hecker
2002-11-26  6:49         ` Sven Luther
2002-11-27 13:12         ` Damien Doligez
2002-11-27 18:04           ` Chris Hecker
2002-11-27 21:04             ` Gerd Stolpmann
2002-11-27 21:45               ` Quetzalcoatl Bradley [this message]
2002-11-26  9:02     ` Xavier Leroy
2002-11-26  9:29       ` Sven Luther
2002-11-26  9:34         ` Xavier Leroy
2002-11-26  9:39           ` Sven Luther
2002-11-26 18:42       ` Chris Hecker
2002-11-26 19:04   ` Dave Berry
2002-11-27  0:07   ` Lauri Alanko

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=9AEA7798-0251-11D7-8AD6-003065AB3928@blackfen.com \
    --to=qbradley@blackfen.com \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).