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

Potential incorrect mutex usage in ptex cache construction #409

Closed
Hyiker opened this issue Jan 16, 2024 · 1 comment
Closed

Potential incorrect mutex usage in ptex cache construction #409

Hyiker opened this issue Jan 16, 2024 · 1 comment

Comments

@Hyiker
Copy link

Hyiker commented Jan 16, 2024

In src/pbrt/texture.cpp:598, the constructor of PtexTextureBase:

std::mutex mutex;
mutex.lock();
if (!cache) {
    int maxFiles = 100;
    size_t maxMem = 1ull << 32;  // 4GB
    bool premultiply = true;

    cache = Ptex::PtexCache::create(maxFiles, maxMem, premultiply, nullptr,
                                    &errorHandler);
    // TODO? cache->setSearchPath(...);
}
mutex.unlock();

a non-static mutex is constructed to ensure thread safe ptex cache creation, I didn't get it, perhaps it's a mistake?

@mmp mmp closed this as completed in 51e68cc Jan 25, 2024
@mmp
Copy link
Owner

mmp commented Jan 25, 2024

Wow, yeah, that was a definite mistake! Thanks for reporting that. Fixed now.

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