gdal
gdal copied to clipboard
GDALGetCacheMax64() TSAN complaint
Super low priority...
In the I don't really care category, but TSAN complained about GDALGetCacheMax64(). It doesn't like the bool check: if( !bCacheMaxInitialized ). I don't think that two threads getting into this code would really be a big deal. This would easily solve with call_once, but this would be the first use of call_once in GDAL. But maybe it's not so easy since there interaction in GDALSetCacheMax64() for bCacheMaxInitialized
namespace {
std::once_flag flagSetupGDALGetCacheMax64;
}
GIntBig CPL_STDCALL GDALGetCacheMax64()
{
std::call_once(flagSetupGDALGetCacheMax64, [](){
// All the setup code here.
});
return nCacheMax;
}
https://en.cppreference.com/w/cpp/thread/call_once
@schwehr Could you confirm https://github.com/OSGeo/gdal/pull/9253 fixes this issue ? I couldn't reproduce a TSAN warning with gcc 9 -sanitize=thread