docs(code): close-out comment fixes from the follow-ups review round
This commit is contained in:
@@ -1036,6 +1036,9 @@ public sealed class ScriptedAlarmEngine : IDisposable
|
||||
Task work;
|
||||
try
|
||||
{
|
||||
// The null coalesce is defensive only: no current caller can return a null Task
|
||||
// (every factory is an async lambda or returns a started Task). It costs nothing and
|
||||
// keeps a future non-async factory from NREing the continuation wiring below.
|
||||
work = factory() ?? Task.CompletedTask;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1057,6 +1060,9 @@ public sealed class ScriptedAlarmEngine : IDisposable
|
||||
// so Dispose's WhenAll still observes (and logs) a background failure.
|
||||
work.ContinueWith(t =>
|
||||
{
|
||||
// Removing BEFORE completing the placeholder is safe (not a window where Dispose could
|
||||
// miss still-running work): this continuation only runs once the REAL task has already
|
||||
// finished, so anything a concurrent Dispose could still be waiting for is done.
|
||||
lock (_inFlightLock) { _inFlight.Remove(placeholder.Task); }
|
||||
if (t.IsFaulted)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user