Does Task.Run guarantee each method will be run to completion
up vote
0
down vote
favorite
There are two methods that together must be run in parallel, this is due to a time constraint. The next piece of data to work on is coming every 100ms for example. List<Widget> widgetList = new List<Widget>() { file list with 100 widget objects } List<Task> tasks = new List<Task>(); foreach (Widget widget in widgetList) { Task t = Task.Run(async () => { var result = await widget.Analyze(newData); ReportResults(result); }); tasks.Add(t); } Task.WaitAll(tasks.ToArray()); No it is not a complete code example but should be enough for the question which is as follows: Can I be sure that ReportResults(result) will run to completion per Task or is it possible that if a Task finishes and calls ReportResults(result) and ...