mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
core(ocl): fix deadlock in UMatDataAutoLock
UMatData locks are not mapped on real locks (they are mapped to some "pre-initialized" pool). Concurrent execution of these statements may lead to deadlock: - a.copyTo(b) from thread 1 - c.copyTo(d) from thread 2 where: - 'a' and 'd' are mapped to single lock "A". - 'b' and 'c' are mapped to single lock "B". Workaround is to process locks with strict order.
This commit is contained in:
@@ -123,6 +123,8 @@
|
||||
#include "opencv2/core/opencl/opencl_svm.hpp"
|
||||
#endif
|
||||
|
||||
#include "umatrix.hpp"
|
||||
|
||||
namespace cv { namespace ocl {
|
||||
|
||||
#define IMPLEMENT_REFCOUNTABLE() \
|
||||
@@ -5424,8 +5426,7 @@ public:
|
||||
srcrawofs, new_srcofs, new_srcstep,
|
||||
dstrawofs, new_dstofs, new_dststep);
|
||||
|
||||
UMatDataAutoLock src_autolock(src);
|
||||
UMatDataAutoLock dst_autolock(dst);
|
||||
UMatDataAutoLock src_autolock(src, dst);
|
||||
|
||||
if( !src->handle || (src->data && src->hostCopyObsolete() < src->deviceCopyObsolete()) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user