From 1ac351d594e559b5fa20bcdacb6b939b1b1ac8c0 Mon Sep 17 00:00:00 2001 From: deflected Date: Fri, 20 Apr 2018 21:25:41 +0300 Subject: [PATCH] bullet: Allow intractions with bullet world during tick callbacks - Release the global lock during the user tick callback and allow interactions with bullet world - Acquire the lock again after the callback Signed-off-by: deflected --- panda/src/bullet/bulletWorld.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index 9732760460..6098759581 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -1186,7 +1186,12 @@ tick_callback(btDynamicsWorld *world, btScalar timestep) { CallbackObject *obj = w->_tick_callback_obj; if (obj) { BulletTickCallbackData cbdata(timestep); + // Release the global lock that we are holding during the tick callback + // and allow interactions with bullet world in the user callback + get_global_lock().release(); obj->do_callback(&cbdata); + // Acquire the global lock again and protect the execution + get_global_lock().acquire(); } }