From ba10b7eedfa8e208fecb546f2b74f88a50831aef Mon Sep 17 00:00:00 2001 From: "DESKTOP-O6U9TBJ\\Lilith" Date: Thu, 26 Oct 2023 00:42:10 -0700 Subject: [PATCH] improve compiletimestatics documentation; add missing using --- src/Arch.SourceGen/QueryGenerator.cs | 1 + src/Arch/Core/Utils/CompileTimeStatics.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Arch.SourceGen/QueryGenerator.cs b/src/Arch.SourceGen/QueryGenerator.cs index f9e4b7a0..23b8f9e6 100644 --- a/src/Arch.SourceGen/QueryGenerator.cs +++ b/src/Arch.SourceGen/QueryGenerator.cs @@ -18,6 +18,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var compileTimeStatics = new StringBuilder(); compileTimeStatics.AppendLine("using System;"); + compileTimeStatics.AppendLine("using System.Threading;"); compileTimeStatics.AppendLine("namespace Arch.Core.Utils;"); compileTimeStatics.AppendGroups(25); diff --git a/src/Arch/Core/Utils/CompileTimeStatics.cs b/src/Arch/Core/Utils/CompileTimeStatics.cs index 3351604f..caa3f881 100644 --- a/src/Arch/Core/Utils/CompileTimeStatics.cs +++ b/src/Arch/Core/Utils/CompileTimeStatics.cs @@ -70,9 +70,13 @@ public static implicit operator Type(ComponentType value) /// The class, tracks all used components in the project. /// Those are represented by 's. /// +/// +/// Simultaneous readers are supported, but simultaneous readers and writers are not. +/// Ensure that modification happens on an isolated thread. +/// In this is implemented via marked structural-change methods. +/// public static class ComponentRegistry { - /// /// All registered components, maps their to their . /// @@ -406,6 +410,9 @@ public static class Component /// /// Searches a by its . If it does not exist, it will be added. /// + /// + /// Not thread-safe; ensure no other threads are accessing or modifying the . + /// /// The . /// The . [MethodImpl(MethodImplOptions.AggressiveInlining)]