Skip to content

Implement an 'Entity Lock' type which pauses creation, destruction and thread/script updates while the lock is held #77

Description

@ImmutableOctet

This lock would help prevent critical modifications of an entity from taking place while it is held. Once Entity Threads are running in parallel (e.g. on a thread scheduler), there is currently no guarantee that operations on other entities will be safe.

The idea here is to have a lock type that leverages RAII to ensure the work in the current scope is executed safely. Once the scope is exited, or if e.g. a loop iteration is completed, a different co_await is hit, etc. we can automatically unlock the entity, allowing other work to be performed.

Locks could be made more efficient by associating the entity's 'batch', rather than the entity itself -- we could then use a mutex/critical-section object per-batch.

Activity

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

Metadata

Metadata

Labels

C++ Script APIFeatureNew feature or requestIdeaIdeas, concepts, etc. (for features without a clear scope yet)Memory SafetyThread Safetymodule: engineFor features that involve the `engine` module. (optional)

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions