aboutsummaryrefslogtreecommitdiff
path: root/src/transformations/hgridshift.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-02 18:07:46 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-06-02 18:08:48 +0200
commite297475f0d05b3c8cfbc5cee90add7d7a37c6a02 (patch)
tree04d0050b002696dd7b2e15c1bd42b902f555c2f6 /src/transformations/hgridshift.cpp
parentfdfeae1908e8bf9e199aed3654ff418aaaa4fe26 (diff)
downloadPROJ-e297475f0d05b3c8cfbc5cee90add7d7a37c6a02.tar.gz
PROJ-e297475f0d05b3c8cfbc5cee90add7d7a37c6a02.zip
Cleanup: add proj/internal/mutex.hpp as compat layer for mingw32 for std::mutex
Diffstat (limited to 'src/transformations/hgridshift.cpp')
-rw-r--r--src/transformations/hgridshift.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/transformations/hgridshift.cpp b/src/transformations/hgridshift.cpp
index 326bbb13..96b77c20 100644
--- a/src/transformations/hgridshift.cpp
+++ b/src/transformations/hgridshift.cpp
@@ -6,31 +6,16 @@
#include <time.h>
#include "proj_internal.h"
+#include "proj/internal/mutex.hpp"
#include "grids.hpp"
PROJ_HEAD(hgridshift, "Horizontal grid shift");
-using namespace NS_PROJ;
-
-#ifdef __MINGW32__
-// mingw32-win32 doesn't implement std::mutex
-namespace {
-class MyMutex {
- public:
- // cppcheck-suppress functionStatic
- void lock() { pj_acquire_lock(); }
- // cppcheck-suppress functionStatic
- void unlock() { pj_release_lock(); }
-};
-}
-#else
-#include <mutex>
-#define MyMutex std::mutex
-#endif
-
-static MyMutex gMutex{};
+static NS_PROJ::mutex gMutex{};
static std::set<std::string> gKnownGrids{};
+using namespace NS_PROJ;
+
namespace { // anonymous namespace
struct hgridshiftData {
double t_final = 0;
@@ -208,7 +193,6 @@ PJ *TRANSFORMATION(hgridshift,0) {
}
void pj_clear_hgridshift_knowngrids_cache() {
- gMutex.lock();
+ NS_PROJ::lock_guard<NS_PROJ::mutex> lock(gMutex);
gKnownGrids.clear();
- gMutex.unlock();
}