Issues with multi-threaded Bullet

Post Reply
SpiderBraids
Posts: 1
Joined: Sun Oct 19, 2014 7:53 am

Issues with multi-threaded Bullet

Post by SpiderBraids »

I have been trying to convert a program from single-thread Bullet to multi-threaded Bullet, and I've encountered two different issues:

1. I adapted the code from the Multi-Threaded demo, and I discovered a major issue in the implementation (at least when using PThreads): When creating the thread supports for the collisions and solving, I found that the constructor creates a static main semaphore, which means that both supports share the same semaphore. When doing the cleanup, it deletes the thread support for the solver, freeing the main semaphore. Then, when deleting the SPU dispatcher, it also calls stopSPU() on the thread support for the collision, which attempts to free the main semaphore... again, resulting in a crash. The Multi-Threaded demo never encounters this issue, because it automatically exits upon closing the GL window, without calling the cleanup routine.

2. I've run tests between single-threaded and multi-threaded, and from my tests, it appears that the multi-threaded runs slower than the single-threaded version. Any suggestions?
Post Reply