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 IAA20817 for caml-redistribution; Mon, 22 Sep 1997 08:58:08 +0200 (MET DST) 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 QAA21592 for ; Thu, 18 Sep 1997 16:18:29 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.5) with ESMTP id QAA20705; Thu, 18 Sep 1997 16:18:27 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA21587; Thu, 18 Sep 1997 16:18:26 +0200 (MET DST) From: Xavier Leroy Message-Id: <199709181418.QAA21587@pauillac.inria.fr> Subject: Re: camlex/camlyacc + threads problem In-Reply-To: <199709100817.KAA05734@yeti.didac-mip.fr> from Olivier Bouyssou at "Sep 10, 97 10:17:24 am" To: bouyssou@didac-mip.fr Date: Thu, 18 Sep 1997 16:18:26 +0200 (MET DST) Cc: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > I've a problem when I use a parser in multiple threads. If the calls to the > parser are not enclosed by a mutex, there are parse errors. ( See example in > french version ) Of course. Most of the O'Caml standard library is *not* thread-safe yet. So far, everything in Pervasives is thread-safe, in particular I/O, but other stateful libraries are not. This includes in particular Hashtbl, Queue, and Lexing. There are no easy ways to make a library thread-safe and still have it working in the non-threaded case. So, I'm not promising these problems will be fixed soon. In the meantime, use mutexes liberally, or make sure that only one thread is doing e.g. parsing. - Xavier Leroy