38 #include <visp3/core/vpConfig.h>
40 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && (defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)))
42 #if defined(VISP_HAVE_PTHREAD)
51 #ifdef ENABLE_VISP_NAMESPACE
70 class VP_DEPRECATED vpMutex
75 #if defined(VISP_HAVE_PTHREAD)
76 pthread_mutex_init(&m_mutex,
nullptr);
79 m_mutex = CreateMutexEx(
nullptr,
nullptr, 0,
nullptr);
81 m_mutex = CreateMutex(
nullptr,
85 if (m_mutex ==
nullptr) {
86 std::cout <<
"CreateMutex error: " << GetLastError() << std::endl;
93 #if defined(VISP_HAVE_PTHREAD)
94 pthread_mutex_lock(&m_mutex);
98 dwWaitResult = WaitForSingleObjectEx(m_mutex, INFINITE, FALSE);
100 dwWaitResult = WaitForSingleObject(m_mutex,
103 if (dwWaitResult == WAIT_FAILED)
104 std::cout <<
"lock() error: " << GetLastError() << std::endl;
109 #if defined(VISP_HAVE_PTHREAD)
110 pthread_mutex_unlock(&m_mutex);
111 #elif defined(_WIN32)
113 if (!ReleaseMutex(m_mutex)) {
115 std::cout <<
"unlock() error: " << GetLastError() << std::endl;
187 vpScopedLock(vpMutex &mutex) : _mutex(mutex) { _mutex.lock(); }
189 virtual ~vpScopedLock() { _mutex.unlock(); }
193 #if defined(VISP_HAVE_PTHREAD)
194 pthread_mutex_t m_mutex;
195 #elif defined(_WIN32)
199 #ifdef ENABLE_VISP_NAMESPACE