msSetup() in mapserv.c and shp2img.c

Frank Warmerdam warmerdam at POBOX.COM
Fri Jul 6 16:34:54 EDT 2007


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,
-- 
---------------------------------------+--------------------------------------
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    | President OSGeo, http://osgeo.org



More information about the mapserver-dev mailing list