From 0748d2beea3d878c3a7f667b2c7efb9ba3f00a5b Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 9 Feb 2012 17:28:31 -0800 Subject: [PATCH] avoid mutex locks on pj_transform for proj 4.7 and above - closes #1072 --- src/proj_transform.cpp | 6 ++++-- src/projection.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index c52dfd7c6..e6f0965c4 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -102,7 +102,8 @@ bool proj_transform::forward (double * x, double * y , double * z, int point_cou } do { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +// https://github.com/mapnik/mapnik/issues/1072 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(projection::mutex_); #endif if (pj_transform( source_.proj_, dest_.proj_, point_count, @@ -153,7 +154,8 @@ bool proj_transform::backward (double * x, double * y , double * z, int point_co } do { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +// https://github.com/mapnik/mapnik/issues/1072 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(projection::mutex_); #endif diff --git a/src/projection.cpp b/src/projection.cpp index 5fc97e150..66706edb6 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -34,7 +34,7 @@ namespace mapnik { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 boost::mutex projection::mutex_; #endif @@ -84,7 +84,7 @@ std::string const& projection::params() const void projection::forward(double & x, double &y ) const { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(mutex_); #endif projUV p; @@ -102,7 +102,7 @@ void projection::forward(double & x, double &y ) const void projection::inverse(double & x,double & y) const { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(mutex_); #endif if (is_geographic_) @@ -120,7 +120,7 @@ void projection::inverse(double & x,double & y) const projection::~projection() { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(mutex_); #endif if (proj_) pj_free(proj_); @@ -131,7 +131,7 @@ projection::~projection() void projection::init() { -#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 +#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470 mutex::scoped_lock lock(mutex_); #endif #if PJ_VERSION >= 480