DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.51k stars 217 forks source link

Multithreading and CUDA #151

Open lp64ace opened 4 years ago

lp64ace commented 4 years ago

Is it possible to add multithreading computation through std::thread or CUDA for collision world. Specifically I want to be able to cast rays asynchronously and then wait for the answers or something similar.

DanielChappuis commented 4 years ago

Yes it is planned to implement CPU multi-threading. However, I don't have know when exactly. I will release version 0.8.0 of the library in the next days and then focus on robustness. Then I will start working on multi-threading.

mrakh commented 4 years ago

User defined callbacks running in parallel might cause undefined behavior if they modify a shared state. In order to guarantee thread safety, you'd have to guard user callback invocations with a mutex, or dispatch callback invocations to a single-reader event queue.