Merge pull request #3340 from lightmare/gdal-register-once

call GDALAllRegister once, from one thread only
This commit is contained in:
lightmare 2016-03-02 22:19:07 +01:00
commit 80d9aebb79

View file

@ -45,6 +45,12 @@ using mapnik::layer_descriptor;
using mapnik::datasource_exception;
static bool GDALAllRegister_once_()
{
static bool const quiet_unused = (GDALAllRegister(), true);
return quiet_unused;
}
gdal_datasource::gdal_datasource(parameters const& params)
: datasource(params),
dataset_(nullptr),
@ -54,12 +60,12 @@ gdal_datasource::gdal_datasource(parameters const& params)
{
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";
GDALAllRegister_once_();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init");
#endif
GDALAllRegister();
boost::optional<std::string> file = params.get<std::string>("file");
if (! file) throw datasource_exception("missing <file> parameter");