From a2c4e3a654eb2bdc106be0aaa1d3fb94000195c5 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sun, 1 Nov 2015 02:49:08 +0000 Subject: [PATCH] Task.Run -> ThreadPool.QueueUserWorkItem Task.Run eventually ends up being QueueUserWorkItem. The returned task is ignored, so no added goodness. Short running item. Cut out the middleman --- src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs index 0eb74bb90..98910340a 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs @@ -128,7 +128,7 @@ public void IncomingComplete(int count, Exception error) if (awaitableState != _awaitableIsCompleted && awaitableState != _awaitableIsNotCompleted) { - Task.Run(awaitableState); + ThreadPool.QueueUserWorkItem((o) => ((Action)o)(), awaitableState); } } @@ -194,7 +194,7 @@ public void OnCompleted(Action continuation) } else if (awaitableState == _awaitableIsCompleted) { - Task.Run(continuation); + ThreadPool.QueueUserWorkItem((o) => ((Action)o)(), continuation); } else {