diff --git a/PowerThreadPool/Core/PowerThreadPool.cs b/PowerThreadPool/Core/PowerThreadPool.cs
index c3f1c8cd..c79d3041 100644
--- a/PowerThreadPool/Core/PowerThreadPool.cs
+++ b/PowerThreadPool/Core/PowerThreadPool.cs
@@ -839,7 +839,11 @@ private void IdleSetting()
///
internal void SetWorkOwner(WorkBase work)
{
- _aliveWorkDic[work.ID] = work;
+ if (!work.IsAlive)
+ {
+ work.IsAlive = true;
+ _aliveWorkDic[work.ID] = work;
+ }
}
///
diff --git a/PowerThreadPool/Works/Work.cs b/PowerThreadPool/Works/Work.cs
index 2bf97d00..fa7edbf2 100644
--- a/PowerThreadPool/Works/Work.cs
+++ b/PowerThreadPool/Works/Work.cs
@@ -445,6 +445,7 @@ internal override bool ShouldRequeue(ExecuteResultBase executeResult)
public override void Dispose()
{
+ IsAlive = false;
if (PauseSignal != null)
{
PauseSignal.Dispose();
diff --git a/PowerThreadPool/Works/WorkBase.cs b/PowerThreadPool/Works/WorkBase.cs
index c01e29d4..d75e5d44 100644
--- a/PowerThreadPool/Works/WorkBase.cs
+++ b/PowerThreadPool/Works/WorkBase.cs
@@ -17,6 +17,7 @@ internal abstract class WorkBase : WorkItemBase, IDisposable
internal PowerPool PowerPool { get; set; }
internal AsyncWorkInfo AsyncWorkInfo { get; set; }
internal CancellationTokenSource CancellationTokenSource { get; set; }
+ internal bool IsAlive { get; set; } = false;
internal volatile int _executeCount;
internal int ExecuteCount
{