优化了流程的进行

This commit is contained in:
fengjiayi
2024-09-15 22:07:10 +08:00
parent fe2ccaf74c
commit 61d40977ff
21 changed files with 153 additions and 117 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using Serein.Library.Ex;
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
namespace Serein.Library.Core.NodeFlow.Tool
{
@@ -13,9 +14,8 @@ namespace Serein.Library.Core.NodeFlow.Tool
// }
//}
public class TcsSignal<TSignal> where TSignal : struct, Enum
public class TcsSignalFlipflop<TSignal> where TSignal : struct, Enum
{
//public ConcurrentDictionary<TSignal, Queue<TaskCompletionSource<object>>> TcsEvent { get; } = new();
public ConcurrentDictionary<TSignal, TaskCompletionSource<object>> TcsEvent { get; } = new ConcurrentDictionary<TSignal, TaskCompletionSource<object>>();
public ConcurrentDictionary<TSignal, object> TcsLock { get; } = new ConcurrentDictionary<TSignal, object>();
@@ -56,7 +56,7 @@ namespace Serein.Library.Core.NodeFlow.Tool
{
foreach (var tcs in TcsEvent.Values)
{
tcs.SetException(new Exception("任务取消"));
tcs.SetException(new FlipflopException("任务取消"));
}
TcsEvent.Clear();
}