Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlex/camlyacc + threads problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: camlex/camlyacc + threads problem
> 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