Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
perl4caml crashed with threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Re: perl4caml crashed with threads
On Tue, Nov 15, 2005 at 02:03:20AM +0000, xuzq wrote:
> Yes,it 's ok without threads and i see perl4caml may not be
> thread-safe.I 'm only curious about why only "eval" crashes and
> "call" looks fine.In my program another thread run the following
> code without any error.

I'm guessing that 'call' works by luck.

I had a quick scan of the code and I can't see anything obviously
unsafe.  Since I never release the OCaml lock in any of the C code,
surely the C calls are all serialised?  It might also be that
perl4caml_init is being called twice (from two threads) which would
probably cause bad things to happen.  A simple print statement should
diagnose whether this is the case.

To be honest, I'm not sure what the threading issues are when calling
external C libraries.  I rarely even use threading in OCaml, and as
you probably guessed, I've never used it at all from perl4caml.

> Thank you for your excellent perl4caml,Richard!Would it be possible for perl
> to callocaml code just like the Inline::OCaml thoughts in that post:

Inline::OCaml would certainly be nice to have, but I don't have the
time, or possibly even the skills, to write it.


Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology -
Team Notepad - intranets and extranets for business -