Using thread local variables instead of the global ones

Sean Gillies sgillies at FRII.COM
Fri Apr 28 10:41:41 EDT 2006

On Apr 28, 2006, at 5:45 AM, Szekeres Tamás wrote:

> Steve, Frank
> Both of you are in right.
> The primary aim would be to eliminate the need of the
> unnecessary locks around the processwide global variables.=20
> It may dissolve the pool of threads resposible for serving
> the user requests.
> I agree with Steve in that using thread locals is just a
> makeshift it would be desirable to eliminate the processwide
> globals at all.
> The storage specifier would be an easy way to rewrite the
> existing code but Frank's note is a bit diappointing. As far
> as I know __tread with gcc can do handle this problem. Maybe
> Microsoft will reach this level until the end of this
> decade. Using the Win TLS API would be more complicated but
> not impossible to use. However the number of the TLS slots
> are limited depending on the operating system.
> At a first sight i have found *only* the following problems
> in the core mapserver code. Some of the variables contain
> invariant data and therefore not to be guarded.



This analysis is pretty much what I did before I wrote

It's great to see renewed interest and attention to this issue! If  
you see anything in that doc that needs to be changed, feel free to  
make edits.


Sean Gillies

More information about the mapserver-dev mailing list