<PackageReference Include="NUnit" Version="3.9.0" />

ThreadUtility

public static class ThreadUtility
ThreadUtility provides a set of static methods convenient for working with threads.
public static void Abort(Thread thread, int nativeId = 0)

Abort a thread, helping to dislodging it if it is blocked in native code

public static void Delay(int milliseconds, WaitCallback threadPoolWork, object state = null)

Pre-Task compatibility

public static int GetCurrentThreadNativeId()

Captures the current thread's native id. If provided to Kill later, allows the thread to be killed if it's in a message pump native blocking wait.

public static void Kill(Thread thread, int nativeId = 0)

Do our best to kill a thread

public static void Kill(Thread thread, object stateInfo, int nativeId = 0)

Do our best to kill a thread, passing state info