pub fn initialize_property_id<E: Entity>(property_id: &AtomicUsize) -> usizeExpand description
Encapsulates the synchronization logic for initializing an item’s index.
Acquires a global lock on the next available property ID, but only increments it if we successfully initialize the provided ID. The ID of a property is assigned at runtime but only once per type. It’s possible for a single type to attempt to initialize its index multiple times from different threads, which is why all this synchronization is required. However, the overhead is negligible, as this initialization only happens once upon first access.
In fact, for our use case we know we are calling this function
once for each type in each Property’s ctor function, which
should be the only time this method is ever called for the type.