SmartThreadPool
SmartThreadPool copied to clipboard
Add ability to wait for Thread to Abort
We have the need to wait for a cancelled work item to be aborted, so here's the ability to join to the aborted thread until it exits or there is a timeout
Hi,
You shouldn't rely on Thread.Abort()
in your code.
It is even not supported in latest .net core versions see https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread.abort
Check the PostExecuteWorkItemCallback
delegate to know when a work item completed (successfully or cancelled).
You can use the event SmartThreadPool.OnThreadTermination
to know when a thread is terminating.
You can check if a work items is cancelled during its execution using SmartThreadPool.IsWorkItemCanceled
Also note that the code build fails, probably on missing modified file in the commit.
Ami
Hi,
You shouldn't rely on
Thread.Abort()
in your code. It is even not supported in latest .net core versions see https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread.abort
Yes, I know. Unfortunately we don't have a choice here as we're calling thirdparty code with no cancellation support, and it sometimes just hangs.
Also note that the code build fails, probably on missing modified file in the commit.
Right. Fixed