sofa icon indicating copy to clipboard operation
sofa copied to clipboard

[Collision.Response.Contact] Make contactId thread-safe

Open fredroy opened this issue 1 year ago • 3 comments

~~for thread-safety, and each thread/simu would have its own pool of contact id~~

~~An other solution would be to put a guard_lock/mutex each time the ids are accessed but it would share the same pool of contact id to the whole set of thread/simu~~

Make the counter of ContactId atomic. A side effect is to remove the ability to restore previous contactid which was destroyed and set in a side container. I dont think we really need to save some "ids" because we will never overrun the 64 bit integer IMO (18446744073709551615 is quite big 🙃)


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

fredroy avatar Mar 12 '24 13:03 fredroy

[ci-build][with-all-tests]

fredroy avatar Mar 15 '24 08:03 fredroy

Error Win: ContactIdentifier.h(39): error C2492: 'sofa::component::collision::response::contact::ContactIdentifier::cpt': data with thread storage duration may not have dll interface

hugtalbot avatar Mar 20 '24 09:03 hugtalbot

[ci-build][with-all-tests]

fredroy avatar Mar 21 '24 04:03 fredroy