Sharing RigidBodyHandle between threads

help

#1

Hello,

I am trying to integrate nphysics2d with specs and I am facing an issue with RigidBodyHandle being non-thread-safe since it’s defined as:

pub type RigidBodyHandle = Rc<RefCell<RigidBody>>;

Is there a way to make RigidBodyHandle thread safe so that I can store it in specsComponents?


#2

Hi,

Unfortunately, no. I think the only way would be to use Arc<RWLock<...>> instead of Rc<RefCell<...>> but this is not the case yet. Making such a change would be interesting but I did not have the time yet to see if that would impact the performances and ergonomics negatively.