Put threads into background before starting
This commit is contained in:
parent
99ccae64eb
commit
58e07a8b2b
|
|
@ -52,6 +52,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel
|
||||||
_post = new UvAsyncHandle(_log);
|
_post = new UvAsyncHandle(_log);
|
||||||
_thread = new Thread(ThreadStart);
|
_thread = new Thread(ThreadStart);
|
||||||
_thread.Name = "KestrelThread - libuv";
|
_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;
|
QueueCloseHandle = PostCloseHandle;
|
||||||
QueueCloseAsyncHandle = EnqueueCloseHandle;
|
QueueCloseAsyncHandle = EnqueueCloseHandle;
|
||||||
}
|
}
|
||||||
|
|
@ -79,12 +84,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel
|
||||||
|
|
||||||
public void Stop(TimeSpan timeout)
|
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)
|
if (!_initCompleted)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue