Auburn / FastNoise2

Modular node graph based noise generation library using SIMD, C++17 and templates
MIT License
1.02k stars 107 forks source link

Thread safety crash when launching noises from background thread. #136

Open vblanco20-1 opened 5 months ago

vblanco20-1 commented 5 months ago

With std::shared ptr option on or off. Doesnt matter. Happens randomly.

Seems to be related to https://github.com/Auburn/FastNoise2/issues/100 which happens again.

To replicate: Use taskflow or other similar parallel lib to launch multiple generators at once, in my project im launching 4 tasks to do noises at the same time. It seems initialization of simd structures causes a race condition. Currently debugging what is going on here to add more info to this issue.

Auburn commented 5 months ago

I've seen some other instances of this, I think I've got a proper fix for it in the upcoming release. In the mean time try calling GetSIMDLevel() on the main thread before starting your threads, which should stop the threads contesting the initialisation