Fixing race condition by expanding resultsMutex lock section
(cherry picked from commit 042ff210d5
)
This commit is contained in:

committed by
Alexander Smorkalov

parent
fcbefaff86
commit
39ac84ff04
@@ -196,18 +196,16 @@ namespace cv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultsMutex.lock();
|
||||||
if (localInliers.size() > inliers.size())
|
if (localInliers.size() > inliers.size())
|
||||||
{
|
{
|
||||||
resultsMutex.lock();
|
|
||||||
|
|
||||||
inliers.clear();
|
inliers.clear();
|
||||||
inliers.resize(localInliers.size());
|
inliers.resize(localInliers.size());
|
||||||
memcpy(&inliers[0], &localInliers[0], sizeof(int) * localInliers.size());
|
memcpy(&inliers[0], &localInliers[0], sizeof(int) * localInliers.size());
|
||||||
localRvec.copyTo(rvec);
|
localRvec.copyTo(rvec);
|
||||||
localTvec.copyTo(tvec);
|
localTvec.copyTo(tvec);
|
||||||
|
|
||||||
resultsMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
resultsMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpTask(const vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints,
|
static void pnpTask(const vector<char>& pointsMask, const Mat& objectPoints, const Mat& imagePoints,
|
||||||
|
Reference in New Issue
Block a user