LongRunning + AttachedToParent task (simultaneously)

My Task should work for a long time (it's like a service), so I need to make it LongRunning .

At the same time, I need to mark it as AttachedToParent to prevent the parent from completing the task before completing my service.

How to combine these two possibilities of creating a task?

+4
source share
1 answer

You can create a task with several creation options: that is.

 var task3 = new Task(() => MyLongRunningMethod(), TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness); task3.Start(); 
+5
source

Source: https://habr.com/ru/post/1482394/


All Articles