[ODE] ODE - thread safety

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Aug 15 10:54:15 MST 2006


You can wrap a big lock around your usage of ODE, so that only one 
thread is inside ODE at any one time. Also, if you can guarantee that no 
mutators are running, then all of the getters/accessors are thread safe.

What I do, is create a specific thread just for running ODE simulation 
and mutation. Then, I tell this thread to "go" which makes it call 
collision and step. Later, I "join" this threads which means wait on an 
event that the simulation thread sets when it's done. At the point where 
it's joined, all the getters can be used, until the next time I tell it 
to "go". This has the added benefit of running simulation on a second 
core on multi-core systems.

Cheers,

          / h+


Mirko Radowitz wrote:
> Hi,
>
> I have a questions to ODE and thread safety. I read that ODE is not thread save, but for my application is that very important.
>
> So can someone tell me, why ODE is not threadsafe?
>
> And maybe someone can explain me how I can make it threadsafe, if it is possible at all?
>
> Many thanks for your help!
>
> Mirko
>
>
>
>
>   


More information about the ODE mailing list