Pavel Voronin
Pavel Voronin

Reputation: 13983

Can Task be started in NOT background thread?

I need to allow task execution after main thread exits. Is it possible? Or I should use Thread class explicitly for this purpose?

Upvotes: 1

Views: 206

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500525

You could write your own task scheduler to schedule tasks on non-threadpool-threads... but a simpler option would probably be to start a foreground thread which just waits for the relevant tasks to complete.

(It's hard to give a code sample as you haven't shown how the tasks are started etc, but it should be fairly easy.)

Upvotes: 3

Related Questions