From d0474a9b813cc4fca6d2f8524ce730d5b1d72891 Mon Sep 17 00:00:00 2001 From: E Sommerlade Date: Wed, 26 Oct 2016 15:37:06 +0100 Subject: [PATCH] fixed use of std::lock outside of ifdefs --- modules/objdetect/src/detection_based_tracker.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/objdetect/src/detection_based_tracker.cpp b/modules/objdetect/src/detection_based_tracker.cpp index 2690f4f9d1..0b643926e8 100644 --- a/modules/objdetect/src/detection_based_tracker.cpp +++ b/modules/objdetect/src/detection_based_tracker.cpp @@ -139,13 +139,24 @@ class cv::DetectionBasedTracker::SeparateDetectionWork } void setParameters(const cv::DetectionBasedTracker::Parameters& params) { +#ifdef USE_STD_THREADS std::unique_lock mtx_lock(mtx); +#else + pthread_mutex_lock(&mutex); +#endif parameters = params; +#ifndef USE_STD_THREADS + pthread_mutex_unlock(&mutex); +#endif } inline void init() { +#ifdef USE_STD_THREADS std::unique_lock mtx_lock(mtx); +#else + pthread_mutex_lock(&mutex); +#endif stateThread = STATE_THREAD_STOPPED; isObjectDetectingReady = false; shouldObjectDetectingResultsBeForgot = false; @@ -153,6 +164,7 @@ class cv::DetectionBasedTracker::SeparateDetectionWork objectDetectorThreadStartStop.notify_one(); #else pthread_cond_signal(&(objectDetectorThreadStartStop)); + pthread_mutex_unlock(&mutex); #endif } protected: