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 PAA28664; Thu, 27 Sep 2001 15:20:49 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA28660 for ; Thu, 27 Sep 2001 15:20:48 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8RDKMX09490; Thu, 27 Sep 2001 15:20:22 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA28627; Thu, 27 Sep 2001 15:20:18 +0200 (MET DST) Date: Thu, 27 Sep 2001 15:20:18 +0200 From: Xavier Leroy To: Chris Quinn Cc: CAML LIST Subject: Re: [Caml-list] C callbacks and threading... Message-ID: <20010927152018.A28468@pauillac.inria.fr> References: <3BB2F29D.DA3E1C57@htec.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3BB2F29D.DA3E1C57@htec.demon.co.uk>; from cq@htec.demon.co.uk on Thu, Sep 27, 2001 at 10:34:21AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > The manual says a caml function can be registered and then used from > the C runtime. Is this still true if called from a thread not > created from within Caml ie. via the Thread module? I have vague > recollections of caml's thread system involving some bookkeeping > which probably rules this usage out. It should work if: - the Caml code doesn't use threads itself; - you call it via callback_exn rather than callback (to make sure you always get control back from the Caml code); - you protect the call to callback_exn by a mutex, to make sure that no two threads can call into Caml simultaneously. In all other cases, and especially if the Caml code is multithreaded, you would probably break something in the Caml runtime system. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr