diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-06-02 19:06:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-02 19:06:15 +0200 |
| commit | 29f849485bf2ea9caa7ca3da7d93ece1daf4d7d5 (patch) | |
| tree | f0180f6659f9c060395a9eee010f18861dbad19b /src/transformations/hgridshift.cpp | |
| parent | a77df0d81bdfb12ef090bc53ed70219f293c04d1 (diff) | |
| parent | e297475f0d05b3c8cfbc5cee90add7d7a37c6a02 (diff) | |
| download | PROJ-29f849485bf2ea9caa7ca3da7d93ece1daf4d7d5.tar.gz PROJ-29f849485bf2ea9caa7ca3da7d93ece1daf4d7d5.zip | |
Merge pull request #2736 from rouault/cleanup_mutex
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.cpp | 26 |
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(); } |
