private NamedThread(string name, Action<CancellationToken> action)
{
Name = name;
lock (Threads)
Threads.Add(name, this);
_thread = new Thread(() =>
{
action(_cts.Token);
_cts.Dispose();
_thread = null;
lock (Threads)
Threads.Remove(name);
});
_thread.Start();
}