user1031034
user1031034

Reputation: 856

How to abort threads when application window is closing

I have a WPF application with threads. How do I abort all threads when closing the application?

Upvotes: 1

Views: 1029

Answers (1)

Matt Davis
Matt Davis

Reputation: 46034

After you create the thread, set the IsBackground property to true.

Thread th = new Thread(new ThreadStart(Start));
th.IsBackground = true;
th.Start();

Upvotes: 4

Related Questions