Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion PowerThreadPool/Core/PowerThreadPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,11 @@ private void IdleSetting()
/// <param name="work"></param>
internal void SetWorkOwner(WorkBase work)
{
_aliveWorkDic[work.ID] = work;
if (!work.IsAlive)
{
work.IsAlive = true;
_aliveWorkDic[work.ID] = work;
}
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions PowerThreadPool/Works/Work.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ internal override bool ShouldRequeue(ExecuteResultBase executeResult)

public override void Dispose()
{
IsAlive = false;
if (PauseSignal != null)
{
PauseSignal.Dispose();
Expand Down
1 change: 1 addition & 0 deletions PowerThreadPool/Works/WorkBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Loading