views:

117

answers:

1

One feature of Threads is that you can set the .IsBackground property to true, and it will not prevent the process from terminating (ie, the framework calls Thread.Abort() on all running background threads at termination)

I can't seem to find a similar feature in Tasks. I used background threads a lot when I create services, where if the thread has not ended gracefully after the timeout period, the framework just kills it. This prevents the service manager from hanging getting into that weird task failed to stop scenario.

Is there a way to treat tasks as background? Or do I have to add the necessary code to abort tasks myself?

A: 

Tasks already run as background threads.

Paul Mendoza
So you're saying that tasks are always background threads? Is there a way to make tasks foreground threads?
Mystere Man