Skip to content

Fix concurrent component type registration - #322

Open
Mr444-dev wants to merge 1 commit into
genaray:masterfrom
Mr444-dev:fix/component-registry-concurrent-registration-239
Open

Mr444-dev wants to merge 1 commit into
genaray:masterfrom
Mr444-dev:fix/component-registry-concurrent-registration-239

Conversation

@Mr444-dev

Copy link
Copy Markdown

Summary

Serialize component type registration and lookup so concurrent first-use registration of the same type returns one ComponentType instead of throwing a duplicate-key exception. Add a regression test that starts 32 callers together and checks that they all receive the same registration.

Fixes #239

Validation

  • Confirmed the regression test fails against the upstream implementation with duplicate-key exceptions, then passes with this change.
  • dotnet test src/Arch.Tests/Arch.Tests.csproj passed in Debug, Debug-Events, Debug-PureECS, Release, Release-Events, and Release-PureECS (143, 158, 130, 143, 158, and 130 tests).
  • dotnet build src/Arch/Arch.csproj --configuration Release succeeded for net8.0, net6.0, and netstandard2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrency issues with component type registration result in duplicate key exception

1 participant