Closed zeux closed 2 years ago
Alternative easy solution is to initialize this in basisu_encoder_init.
This is fine by itself, but when Basis is used from multiple threads, it results in thread sanitizer issues, see report below. Alternative easy solution is to initialize this in basisu_encoder_init.
This is how the code was designed to work. Until you initialize the encoder via this global function you shouldn't use the library.
Ok great - submitted https://github.com/BinomialLLC/basis_universal/pull/319
Right now interval_timer uses lazy initialization.
This is fine by itself, but when Basis is used from multiple threads, it results in thread sanitizer issues, see report below. By itself it's probably benign - the threads would end up initializing more or less the same data, and on x64 at least the order of reads/writes is probably going to work out. However, that makes it more difficult to validate that other issues don't occur.
Let me know if you'd accept a PR fixing this by moving interval_timer field initialization to C++ static construction.