diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt index ae011dc3..486a53b7 100644 --- a/xmpsdk/CMakeLists.txt +++ b/xmpsdk/CMakeLists.txt @@ -46,6 +46,7 @@ if (MSVC) target_compile_definitions(exiv2-xmp PRIVATE XML_STATIC) endif() +include(CheckIncludeFile) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) if (EXV_HAVE_STDINT_H) target_compile_definitions(exiv2-xmp PRIVATE EXV_HAVE_STDINT_H) diff --git a/xmpsdk/src/XMPCore_Impl.cpp b/xmpsdk/src/XMPCore_Impl.cpp index e3632b98..089cdfa7 100644 --- a/xmpsdk/src/XMPCore_Impl.cpp +++ b/xmpsdk/src/XMPCore_Impl.cpp @@ -112,22 +112,25 @@ WXMP_Result void_wResult; // ! Would be OK but overkill to specify PTHREAD_MUTEX_RECURSIVE. bool XMP_InitMutex ( XMP_Mutex * mutex ) { - int err = pthread_mutex_init ( mutex, 0 ); - return (err == 0 ); + // int err = pthread_mutex_init ( mutex, 0 ); + // return (err == 0 ); + return true; } void XMP_TermMutex ( XMP_Mutex & mutex ) { - (void) pthread_mutex_destroy ( &mutex ); + // (void) pthread_mutex_destroy ( &mutex ); } void XMP_EnterCriticalRegion ( XMP_Mutex & mutex ) { - int err = pthread_mutex_lock ( &mutex ); - if ( err != 0 ) XMP_Throw ( "XMP_EnterCriticalRegion - pthread_mutex_lock failure", kXMPErr_ExternalFailure ); + // int err = pthread_mutex_lock ( &mutex ); + // if ( err != 0 ) XMP_Throw ( "XMP_EnterCriticalRegion - pthread_mutex_lock failure", kXMPErr_ExternalFailure ); + mutex.lock(); } void XMP_ExitCriticalRegion ( XMP_Mutex & mutex ) { - int err = pthread_mutex_unlock ( &mutex ); - if ( err != 0 ) XMP_Throw ( "XMP_ExitCriticalRegion - pthread_mutex_unlock failure", kXMPErr_ExternalFailure ); + // int err = pthread_mutex_unlock ( &mutex ); + // if ( err != 0 ) XMP_Throw ( "XMP_ExitCriticalRegion - pthread_mutex_unlock failure", kXMPErr_ExternalFailure ); + mutex.unlock(); } #endif diff --git a/xmpsdk/src/XMPCore_Impl.hpp b/xmpsdk/src/XMPCore_Impl.hpp index 7d57de6c..09b9e4b1 100644 --- a/xmpsdk/src/XMPCore_Impl.hpp +++ b/xmpsdk/src/XMPCore_Impl.hpp @@ -25,8 +25,8 @@ #if XMP_WinBuild #include #else - // Use pthread for both Mac and generic UNIX. - #include + // Use mutex for both Mac and generic UNIX. + #include #endif #if XMP_WinBuild @@ -196,7 +196,8 @@ extern WXMP_Result void_wResult; #endif -#define XMP_Throw(msg,id) { AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); } +// #define XMP_Throw(msg,id) { AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); } +#define XMP_Throw(msg,id) { } // ------------------------------------------------------------------------------------------------- @@ -204,7 +205,7 @@ extern WXMP_Result void_wResult; typedef CRITICAL_SECTION XMP_Mutex; #else // Use pthread for both Mac and generic UNIX. - typedef pthread_mutex_t XMP_Mutex; + typedef std::mutex XMP_Mutex; #endif extern XMP_Mutex sXMPCoreLock;