Merge pull request #12658 from chacha21:clr-mutex
authorchacha21 <chacha21@users.noreply.github.com>
Fri, 28 Sep 2018 16:19:05 +0000 (18:19 +0200)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 28 Sep 2018 16:19:05 +0000 (19:19 +0300)
* hide use of std::mutex from /clr compilation under Visual Studio

C++11 <mutex> is not available when compiling with  /clr under Visual Studio, thus opencv cannot be easily included.
It is fixed by making a CEEMutex wrapper class, around an opaque implementation using std::mutex internally

* fixed compilation outside of Visual Studio

fixed compilation outside of Visual Studio by avoiding some macros

* fixed indentation, prepare getting rid of CEEMutex/CEELockGuard

fixed indentation
After discussion, CEEMutex and CEELockGuard can be totally removed, letting the developer in a /clr context to provide his own implementation

* remove CEEMutex/CEELockGuard

modules/core/include/opencv2/core/utility.hpp

index 4174de8..a906740 100644 (file)
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
@@ -674,8 +676,10 @@ void Mat::forEach_impl(const Functor& operation) {
 
 /////////////////////////// Synchronization Primitives ///////////////////////////////
 
+#if !defined(_M_CEE)
 typedef std::recursive_mutex Mutex;
 typedef std::lock_guard<cv::Mutex> AutoLock;
+#endif
 
 // TLS interface
 class CV_EXPORTS TLSDataContainer