public static void Kill() { if (thread != null) { Task.Factory.StartNew(Application.Exit, CancellationToken.None, TaskCreationOptions.None, thscheduler); thread = null; } }