[antlr-interest] Re: Is ANTRLR Thread safe

Ric Klaren klaren at cs.utwente.nl
Thu May 27 03:24:59 PDT 2004


On Thu, May 27, 2004 at 09:53:38AM -0000, meilland78 wrote:
> Sorry forgot to specify it : C++ language.

The C++ support lib is not thread safe per se. Although if you take care
you can probably get away with a lot. I suggest lots of (generated) source
reading.

If you can keep the whole lexer/parser/treeparser chain in one thread you
can have multiple instances of that thread going (e.g. parse multiple files
concurrently).

The AST/Token classes do not support concurrent (rw) access (although I've
seen report in the past that it was possible to fix the reference counters
for it but that was *way* back). Again you might get away with some
concurrent readonly access. But it's probably best to modify the reference
counter classes to make them thread safe. (there was a post on this
somewhere in the archive but the yahoogroups search seems to have hit an
alltime low in finding stuff)

Problems might come from the ASTNULLType instance there should be only one
instance of it between threads accessing the same AST. You might have to
fiddle it a bit for concurrent access.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  "I don't have anything against Java - it's the best damn implementation
              of UCSD Pascal ever released..." --- Larry Smith



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list