Merge pull request #10582 from mshabunin:fix-ocl-concurrent-cache-name

This commit is contained in:
Alexander Alekhin 2018-01-12 18:43:08 +00:00
commit 69cd9cc1a6

View File

@ -2070,6 +2070,9 @@ struct Context::Impl
std::string& getPrefixString() std::string& getPrefixString()
{ {
if (prefix.empty())
{
cv::AutoLock lock(program_cache_mutex);
if (prefix.empty()) if (prefix.empty())
{ {
CV_Assert(!devices.empty()); CV_Assert(!devices.empty());
@ -2088,11 +2091,15 @@ struct Context::Impl
} }
} }
} }
}
return prefix; return prefix;
} }
std::string& getPrefixBase() std::string& getPrefixBase()
{ {
if (prefix_base.empty())
{
cv::AutoLock lock(program_cache_mutex);
if (prefix_base.empty()) if (prefix_base.empty())
{ {
const Device& d = devices[0]; const Device& d = devices[0];
@ -2110,6 +2117,7 @@ struct Context::Impl
} }
} }
} }
}
return prefix_base; return prefix_base;
} }