[Mapserver-dev] Thread safety question

Frank Warmerdam warmerdam at pobox.com
Wed Feb 11 12:56:58 EST 2004


Steve Lime wrote:
> You are correct, the lexer produced by flex is not thread safe. Bison
> can create a thread-safe parser so if we could find (or write *yuck*) a
> thread-safe lexer that intergrates with bison we'd be ok. Someone
> mention a lexer called lemon as an option. I've not had time to pursue
> though.

Ned / Steve,

Right.  When I added the locking logic, I added locks around the parsing
of the mapfile due to the issues with the lexer not being reentrant.  However,
I see I did not apply locks around the parsing of class expressions when they
are evaluated in places like the msGetClass() function in mapraster.c.  I assume
there are similar issues in other places.

There are two approaches to the problem.  One is to prepare thread safe lexers
by hand, or through use of appropriate lexer generators.  The other is to add
locking around the lexer, either by adding it around all uses of the parser
(including all use of the expression parser), or to use fine grained locks
around just the lexer.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the mapserver-dev mailing list