From 30bd571bc1163cce3c5833114ca8eb8eb341af89 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:33:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ioc):=20=E5=B0=86IocContainer=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=5Ffrozen=E5=AD=97=E6=AE=B5=E6=A0=87=E8=AE=B0=E4=B8=BA?= =?UTF-8?q?volatile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改_frozen字段添加volatile关键字以确保线程安全 - 提高容器状态变更的可见性与一致性 - [no tag] --- GFramework.Core/ioc/IocContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GFramework.Core/ioc/IocContainer.cs b/GFramework.Core/ioc/IocContainer.cs index fe10d91..346aa5c 100644 --- a/GFramework.Core/ioc/IocContainer.cs +++ b/GFramework.Core/ioc/IocContainer.cs @@ -30,7 +30,7 @@ public class IocContainer /// 冻结标志位,用于标识对象是否已被冻结 /// true表示对象已冻结,不可修改;false表示对象可正常修改 /// - private bool _frozen; + private volatile bool _frozen; #endregion