From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA21986 for caml-red; Sun, 3 Dec 2000 23:06:55 +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 SAA26182 for ; Thu, 30 Nov 2000 18:44:27 +0100 (MET) 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 eAUHiQf21938; Thu, 30 Nov 2000 18:44:26 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA29104; Thu, 30 Nov 2000 18:44:25 +0100 (MET) Date: Thu, 30 Nov 2000 18:44:25 +0100 From: Xavier Leroy To: Jocelyn Serot Cc: caml-list@inria.fr Subject: Re: Marshaling of custom blocks and threads Message-ID: <20001130184425.B24738@pauillac.inria.fr> References: <14882.23649.834222.868215@mistral.univ-bpclermont.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <14882.23649.834222.868215@mistral.univ-bpclermont.fr>; from jserot@lasmea.univ-bpclermont.fr on Mon, Nov 27, 2000 at 02:06:41PM +0100 Sender: weis@pauillac.inria.fr > Can s/o please confirm whether the module Marshal (and especially its > usage to serialize custom blocks) is thread-safe in Ocaml 3.0 ? > I remember reading sth about a pb with bytecode threads and marshaling > in a previous version of Ocaml but cannot determine surely whether > the pb has been fixed since. With bytecode threads, there is an issue with Marshal.{to,from}_channel, which can raise a spurious Sys_blocked_io exception. This problem is still in 3.00, and will be corrected in the next release. With system threads, as Gerd Stolpmann said, there used to be a race condition bug in Marshal.to_string, but it is fixed in 3.00. Finally, there is a bug in marshalling of custom objects in 3.00. Manuel Fahndrich posted a fix, which is now in the working sources. > The reason i ask follows : i have a program with (bytecode) threads > exchanging data (float arrays) with Marshal.to_string/ThreadUnix.write and > ThreadUnix.read/Marshal.from_string. Shoud be OK if you apply Manuel's patch. If it still crashes, I'd be interested in a test program that reproduces the crash. In a previous mail, you asked: > Just to know - before i start the work : is there any plans or work > undergoing for integrating the support for Ocaml3.0 "custom blocks" in > the Camlidl stub code generator ? I'm not currently working on this, and actually don't have precise ideas about how to provide support for custom blocks. If you have few custom block types to handle, you can always use a typedef with the "abstract", "c2ml" and "ml2c" attributes pointing to your own packing/unpacking functions. Regards, - Xavier Leroy