mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
core(tls): implement releasing of TLS on thread termination
- move TLS & instrumentation code out of core/utility.hpp - (*) TLSData lost .gather() method (to dispose thread data on thread termination) - use TLSDataAccumulator for reliable collecting of thread data - prefer using of .detachData() + .cleanupDetachedData() instead of .gather() method (*) API is broken: replace TLSData => TLSDataAccumulator if gather required (objects disposal on threads termination is not available in accumulator mode)
This commit is contained in:
@@ -76,13 +76,13 @@ bool haveOpenVX()
|
||||
bool useOpenVX()
|
||||
{
|
||||
#ifdef HAVE_OPENVX
|
||||
CoreTLSData* data = getCoreTlsData().get();
|
||||
if( data->useOpenVX < 0 )
|
||||
CoreTLSData& data = getCoreTlsData();
|
||||
if (data.useOpenVX < 0)
|
||||
{
|
||||
// enabled (if available) by default
|
||||
data->useOpenVX = haveOpenVX() ? 1 : 0;
|
||||
data.useOpenVX = haveOpenVX() ? 1 : 0;
|
||||
}
|
||||
return data->useOpenVX > 0;
|
||||
return data.useOpenVX > 0;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -93,8 +93,8 @@ void setUseOpenVX(bool flag)
|
||||
#ifdef HAVE_OPENVX
|
||||
if( haveOpenVX() )
|
||||
{
|
||||
CoreTLSData* data = getCoreTlsData().get();
|
||||
data->useOpenVX = flag ? 1 : 0;
|
||||
CoreTLSData& data = getCoreTlsData();
|
||||
data.useOpenVX = flag ? 1 : 0;
|
||||
}
|
||||
#else
|
||||
CV_Assert(!flag && "OpenVX support isn't enabled at compile time");
|
||||
|
||||
Reference in New Issue
Block a user