statics to instance

This commit is contained in:
Ben Adams 2015-11-13 13:04:21 +00:00
parent d82c571831
commit 558b0ae643
1 changed files with 12 additions and 12 deletions

View File

@ -64,15 +64,15 @@ namespace Microsoft.AspNet.Server.Kestrel
return; return;
} }
Post((t) => OnStop(t)); Post(t => t.OnStop());
if (!_thread.Join((int)timeout.TotalMilliseconds)) if (!_thread.Join((int)timeout.TotalMilliseconds))
{ {
try try
{ {
Post((t) => OnStopRude(t)); Post(t => t.OnStopRude());
if (!_thread.Join((int)timeout.TotalMilliseconds)) if (!_thread.Join((int)timeout.TotalMilliseconds))
{ {
Post((t) => OnStopImmediate(t)); Post(t => t.OnStopImmediate());
if (!_thread.Join((int)timeout.TotalMilliseconds)) if (!_thread.Join((int)timeout.TotalMilliseconds))
{ {
#if NET451 #if NET451
@ -100,19 +100,19 @@ namespace Microsoft.AspNet.Server.Kestrel
} }
} }
private static void OnStop(KestrelThread thread) private void OnStop()
{ {
thread._post.Unreference(); _post.Unreference();
} }
private static void OnStopRude(KestrelThread thread) private void OnStopRude()
{ {
thread._engine.Libuv.walk( _engine.Libuv.walk(
thread._loop, _loop,
(ptr, arg) => (ptr, arg) =>
{ {
var handle = UvMemory.FromIntPtr<UvHandle>(ptr); var handle = UvMemory.FromIntPtr<UvHandle>(ptr);
if (handle != thread._post) if (handle != _post)
{ {
handle.Dispose(); handle.Dispose();
} }
@ -120,10 +120,10 @@ namespace Microsoft.AspNet.Server.Kestrel
IntPtr.Zero); IntPtr.Zero);
} }
private static void OnStopImmediate(KestrelThread thread) private void OnStopImmediate()
{ {
thread._stopImmediate = true; _stopImmediate = true;
thread._loop.Stop(); _loop.Stop();
} }
private void Post(Action<KestrelThread> callback) private void Post(Action<KestrelThread> callback)