Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityLock<> and Optional<> lock permission, and early lock release optimization #44

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

xthexder
Copy link
Owner

@xthexder xthexder commented Apr 1, 2023

EntityLock<ECS, Permissions...> is a new lock type that is roughly equivalent to a std::pair<Lock<ECS, Permissions...>, Entity>.
This lock type can be used to perform parallel writes to multiple entities within a single transaction, while allowing reads to all entities.
Reads of values on entities not covered by the lock see the value as of the start of the transaction, with changes to other entities hidden until the transaction completes.

The Optional<> lock permission replaces DynamicLock<>, and allows for any existing Lock<ECS, Permissions...> to be declared as optional and checked at runtime.

Locks now properly reference count each component individually, allowing read-only lock permissions to be released early if a lock has been converted to a subset, and no more references to that component exist.
ECS component storage also has a new WriteToReadLock call, which allows a Write permission to be downgraded to Read permissions without starting a new transaction.

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.

1 participant