Hi,
I have a service that do some work with a polling intervall.
Task task = new Task( delegate { DoWork(); });
task.Wait(Convert.ToInt32(ConfigurationManager.AppSettings["PollingInterval"]));
task.RunSynchronously();
My question is how to abort the Task safe?
Is it enough with
try
{
Task task = new Task( delegate { DoWork(); });
task.Wait(Convert.ToInt32(ConfigurationManager.AppSettings["PollingInterval"]));
task.RunSynchronously();
}
catch (ThreadAbortException threadAbortException)
{
// Clean up
}