Hi, beginner here.
There is about 100MB, mutable geometry data in arrays of arrays.
Need to run a multi threaded collision detection, which will randomly read this data, without modifying it.
Once all threads completed, the geometry data needs to be mutable again.
Is there a way to freeze the data and pass it to the collision detection threads without making a of copy of it?
It would be better, if threads aren't created every time. Instead, they should wait for a semaphore from a task manager.
Would Rayon work for you?
Generally, rayon will let you do this easily. It uses a threadpool in the background, so threads are reused, and the threads are scoped, so you will be able to pass an immutable reference to your data to other threads, and the compiler understands it well enough that you can regain mutable access once the threads are done.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.