msSetup() in mapserv.c and shp2img.c

Daniel Morissette dmorissette at MAPGEARS.COM
Fri Jul 6 18:59:00 EDT 2007


Frank,

Thanks for the quick reply. Your explanation makes sense.

Daniel



Frank Warmerdam wrote:
> Daniel Morissette wrote:
>> We have a msSetup() function in maputil.c which is used (at least by 
>> MapScript) to initialize some resources freed later by msCleanup(). It 
>> seems that msSetup() is not called by mapserv.c and shp2img.c?
>>
>> Should mapserv and shp2img not call msSetup() as well since they do 
>> call msCleanup()?
> 
> Daniel,
> 
> As far as I can tell the initializations done in msSetup() can also be
> adequately handled "as needed" if it isn't called.  I gather from the
> comment:
> 
> ------------------------------------------------------------------------------- 
> 
>  msSetup()
> 
>  Contributed by Jerry Pisk in bug 1203.  Heads off potential race condition
>  in initializing GD font cache with multiple threads.  Should be called 
> from
>  mapscript module initialization code.
> ------------------------------------------------------------------------------- 
> 
> 
> that msSetup() is primarily useful in a multi-threaded situation - getting
> some initialization done before extra threads are split off.
> 
> As such, I don't see it is needed at all in shp2img or mapserv.  
> Conversely,
> folks shouldn't put initializations in msSetup() assuming that it will
> actually get called.
> 
> Best regards,


-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-dev mailing list