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
This commit is contained in:
Ben Adams 2015-11-01 02:49:08 +00:00
parent facf3ad0da
commit a2c4e3a654
1 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
if (awaitableState != _awaitableIsCompleted && if (awaitableState != _awaitableIsCompleted &&
awaitableState != _awaitableIsNotCompleted) awaitableState != _awaitableIsNotCompleted)
{ {
Task.Run(awaitableState); ThreadPool.QueueUserWorkItem((o) => ((Action)o)(), awaitableState);
} }
} }
@ -194,7 +194,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
} }
else if (awaitableState == _awaitableIsCompleted) else if (awaitableState == _awaitableIsCompleted)
{ {
Task.Run(continuation); ThreadPool.QueueUserWorkItem((o) => ((Action)o)(), continuation);
} }
else else
{ {