More shutdown tweaks (#1760)

* More shutdown tweaks
- Added assert if loop has ended before starting the shutdown
sequence.
This commit is contained in:
David Fowler 2017-04-29 01:15:10 -07:00 committed by GitHub
parent 7122b6c4aa
commit 9a5d6c8879
1 changed files with 16 additions and 20 deletions

View File

@ -98,8 +98,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
} }
} }
if (!_threadTcs.Task.IsCompleted) Debug.Assert(!_threadTcs.Task.IsCompleted, "The loop thread was completed before calling uv_unref on the post handle.");
{
var stepTimeout = TimeSpan.FromTicks(timeout.Ticks / 3); var stepTimeout = TimeSpan.FromTicks(timeout.Ticks / 3);
try try
@ -125,12 +125,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
_log.LogCritical($"{nameof(LibuvThread)}.{nameof(StopAsync)} failed to terminate libuv thread."); _log.LogCritical($"{nameof(LibuvThread)}.{nameof(StopAsync)} failed to terminate libuv thread.");
} }
} }
}
if (_closeError != null) _closeError?.Throw();
{
_closeError.Throw();
}
} }
#if DEBUG #if DEBUG