Skip to content
Discussion options

You must be logged in to vote

Allocating an entity should be an atomic operation

That's much easier than done IMO, since currently this is inherently a very sequential operation. It requires:

  • allocating all the reserved entities and removing them from the "pending" vector
  • allocating space in the entity metadata Vec for the new entity (may require a resize)
  • allocating space in the archetype entity metadata Vec for the new entity (may also require a resize, also for reserved entities this is the empty archetype)

All of these operations are not easy to make thread-safe. Moreover there's a lot of code that relies on accessing these Vecs to be as fast and cheap as possible, so any form of synchronization may be unwante…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@wzjsun
Comment options

Comment options

You must be logged in to vote
3 replies
@wzjsun
Comment options

@wzjsun
Comment options

@SkiFire13
Comment options

Answer selected by wzjsun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants