[V1] Atomic operations?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Posts: 5
Joined: Sun Aug 12, 2018 5:02 pm

[V1] Atomic operations?

Post by roro56 » Mon Aug 20, 2018 10:55 am

Hi there again :D

I have some doubts about body management in space. I mean I have a simulation working in a separate thread. In the main thread I can add bodies in space or remove them via space's SpaceObjectBuffer. But what if I want to do some atomic operation? I want to add/remove several bodies. How can I garantie that the next simulation update takes into account the whole of that changes or nothing of them? Is it my job or bepu can do it for me automatically?

Site Admin
Posts: 4884
Joined: Tue Jul 04, 2006 4:45 am

Re: [V1] Atomic operations?

Post by Norbo » Mon Aug 20, 2018 10:14 pm

There's no good built in solution for more complex logic like that, so I would recommend just creating your own buffered change queue that you can flush on the physics thread. The SpaceObjectBuffer is nothing special anyway- v2 doesn't even have an analogous feature since it is so low value.

Post Reply