문제

My Task have to 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 parent task completion before my service's task completion.

How to combine this two task creation options?

도움이 되었습니까?

해결책

You can create the task with several creation option: ie.

var task3 = new Task(() => MyLongRunningMethod(),
                TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness);
task3.Start();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top