Implement an 'Entity Lock' type which pauses creation, destruction and thread/script updates while the lock is held #77
Labels
C++ Script API
Feature
New feature or request
Idea
Ideas, concepts, etc. (for features without a clear scope yet)
Memory Safety
module: engine
For features that involve the `engine` module. (optional)
Thread Safety
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.
The text was updated successfully, but these errors were encountered: