Put threads into background before starting

This commit is contained in:
Ben Adams 2016-02-19 21:20:00 +00:00
parent 99ccae64eb
commit 58e07a8b2b
1 changed files with 5 additions and 6 deletions

View File

@ -52,6 +52,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel
_post = new UvAsyncHandle(_log);
_thread = new Thread(ThreadStart);
_thread.Name = "KestrelThread - libuv";
#if !DEBUG
// Mark the thread as being as unimportant to keeping the process alive.
// Don't do this for debug builds, so we know if the thread isn't terminating.
_thread.IsBackground = true;
#endif
QueueCloseHandle = PostCloseHandle;
QueueCloseAsyncHandle = EnqueueCloseHandle;
}
@ -79,12 +84,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel
public void Stop(TimeSpan timeout)
{
#if !DEBUG
// Mark the thread as being as unimportant to keeping the process alive.
// Don't do this for debug builds, so we know if the thread isn't terminating.
_thread.IsBackground = true;
#endif
if (!_initCompleted)
{
return;