Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDALGetCacheMax64() TSAN complaint #1837

Closed
schwehr opened this issue Sep 12, 2019 · 1 comment
Closed

GDALGetCacheMax64() TSAN complaint #1837

schwehr opened this issue Sep 12, 2019 · 1 comment
Assignees

Comments

@schwehr
Copy link
Member

schwehr commented Sep 12, 2019

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

rouault added a commit to rouault/gdal that referenced this issue Feb 19, 2024
@rouault
Copy link
Member

rouault commented Feb 19, 2024

@schwehr Could you confirm #9253 fixes this issue ? I couldn't reproduce a TSAN warning with gcc 9 -sanitize=thread

@rouault rouault self-assigned this Feb 19, 2024
rouault added a commit to rouault/gdal that referenced this issue Feb 19, 2024
rouault added a commit that referenced this issue Feb 26, 2024
GDALGetCacheMax64(): fix TSAN complaint (fixes #1837)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants