Browse thread
[Caml-list] Why systhreads?
[
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: | -- (:) |
| From: | Quetzalcoatl Bradley <qbradley@b...> |
| Subject: | [Caml-list] Calling ocaml from external threads |
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