mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Make global_entity_id atomic
This commit is contained in:
+2
-2
@@ -250,7 +250,7 @@ bool entity_has_deferred_procedure(Entity *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gb_global u64 global_entity_id = 0;
|
gb_global std::atomic<u64> global_entity_id = 0;
|
||||||
|
|
||||||
Entity *alloc_entity(EntityKind kind, Scope *scope, Token token, Type *type) {
|
Entity *alloc_entity(EntityKind kind, Scope *scope, Token token, Type *type) {
|
||||||
gbAllocator a = permanent_allocator();
|
gbAllocator a = permanent_allocator();
|
||||||
@@ -260,7 +260,7 @@ Entity *alloc_entity(EntityKind kind, Scope *scope, Token token, Type *type) {
|
|||||||
entity->scope = scope;
|
entity->scope = scope;
|
||||||
entity->token = token;
|
entity->token = token;
|
||||||
entity->type = type;
|
entity->type = type;
|
||||||
entity->id = ++global_entity_id;
|
entity->id = 1 + global_entity_id.fetch_add(1);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user