From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA18261; Thu, 28 Nov 2002 10:17:42 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA17998 for caml-list@pauillac.inria.fr; Thu, 28 Nov 2002 10:17:42 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA06632 for ; Wed, 27 Nov 2002 22:44:26 +0100 (MET) Received: from star2.baremetal.com (star2.baremetal.com [216.86.113.248]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gARLiOX20623 for ; Wed, 27 Nov 2002 22:44:25 +0100 (MET) Received: from blackfen.com (h139-142-123-131.gtcust.grouptelecom.net [139.142.123.131]) by star2.baremetal.com (8.12.4/8.12.4) with ESMTP id gARLk4Dk013262 for ; Wed, 27 Nov 2002 13:46:04 -0800 Date: Wed, 27 Nov 2002 13:45:54 -0800 Subject: [Caml-list] Calling ocaml from external threads Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) From: Quetzalcoatl Bradley To: caml-list@inria.fr Content-Transfer-Encoding: 7bit In-Reply-To: <20021127210431.GA1066@ice.gerd-stolpmann.de> Message-Id: <9AEA7798-0251-11D7-8AD6-003065AB3928@blackfen.com> X-Mailer: Apple Mail (2.548) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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