重写了节点主动中断功能,修改了运行环境持久化注册已有实例的逻辑。

This commit is contained in:
fengjiayi
2024-12-26 22:24:44 +08:00
parent 7a6f8c407b
commit 3a7a8483e8
24 changed files with 428 additions and 563 deletions

View File

@@ -76,18 +76,18 @@ namespace Serein.Library.Utils
/// 使用 ObjectPool 来复用 TriggerResult 对象
/// </summary>
// 示例 TriggerResult 对象池
public class TriggerResultPool
public class TriggerResultPool<TResult>
{
private readonly ConcurrentExpandingObjectPool<TriggerResult<object>> _objectPool;
private readonly ConcurrentExpandingObjectPool<TriggerResult<TResult>> _objectPool;
public TriggerResultPool(int defaultCapacity = 30)
{
_objectPool = new ConcurrentExpandingObjectPool<TriggerResult<object>>(defaultCapacity);
_objectPool = new ConcurrentExpandingObjectPool<TriggerResult<TResult>>(defaultCapacity);
}
public TriggerResult<object> Get() => _objectPool.Get();
public TriggerResult<TResult> Get() => _objectPool.Get();
public void Return(TriggerResult<object> result) => _objectPool.Return(result);
public void Return(TriggerResult<TResult> result) => _objectPool.Return(result);
}