Skip to content

Commit

Permalink
avoid mutex locks on pj_transform for proj 4.7 and above - closes map…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Feb 24, 2012
1 parent 90fccfe commit 150c9f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/proj_transform.cpp
Expand Up @@ -101,7 +101,8 @@ bool proj_transform::forward (double * x, double * y , double * z, int point_cou
} }


do { 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_); mutex::scoped_lock lock(projection::mutex_);
#endif #endif
if (pj_transform( source_.proj_, dest_.proj_, point_count, if (pj_transform( source_.proj_, dest_.proj_, point_count,
Expand Down Expand Up @@ -152,7 +153,8 @@ bool proj_transform::backward (double * x, double * y , double * z, int point_co
} }


do { 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_); mutex::scoped_lock lock(projection::mutex_);
#endif #endif


Expand Down
10 changes: 5 additions & 5 deletions src/projection.cpp
Expand Up @@ -34,7 +34,7 @@


namespace mapnik { namespace mapnik {


#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470
boost::mutex projection::mutex_; boost::mutex projection::mutex_;
#endif #endif


Expand Down Expand Up @@ -84,7 +84,7 @@ std::string const& projection::params() const


void projection::forward(double & x, double &y ) 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_); mutex::scoped_lock lock(mutex_);
#endif #endif
projUV p; projUV p;
Expand All @@ -102,7 +102,7 @@ void projection::forward(double & x, double &y ) const


void projection::inverse(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_); mutex::scoped_lock lock(mutex_);
#endif #endif
if (is_geographic_) if (is_geographic_)
Expand All @@ -120,7 +120,7 @@ void projection::inverse(double & x,double & y) const


projection::~projection() projection::~projection()
{ {
#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470
mutex::scoped_lock lock(mutex_); mutex::scoped_lock lock(mutex_);
#endif #endif
if (proj_) pj_free(proj_); if (proj_) pj_free(proj_);
Expand All @@ -131,7 +131,7 @@ projection::~projection()


void projection::init() void projection::init()
{ {
#if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 470
mutex::scoped_lock lock(mutex_); mutex::scoped_lock lock(mutex_);
#endif #endif
#if PJ_VERSION >= 480 #if PJ_VERSION >= 480
Expand Down

0 comments on commit 150c9f8

Please sign in to comment.