A class has async method MonitorAsync()
, which starts a long-running parallel operation. I have a collection of these monitors
; these are all kicked off as follows:
internal async Task RunAsync()
{
var tasks = monitors.Select((p) => p.Value.MonitorAsync());
await Task.WhenAll(tasks);
}
If a monitor
falls over, I need to know (basically I will run it up again). I've looked into ContinueWith
and so on but when running a bunch of async tasks in parallel, how can I ensure I definitely know when one ends?
For context, RunAsync
is basically the core of my application.