Never run continuation inline in SocketAwaitable.OnCompleted (#2407)

This commit is contained in:
Stephen Halter 2018-03-19 17:29:49 -07:00 committed by GitHub
parent ac84d9b2fd
commit 5fa658c800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ using System.IO.Pipelines;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
{
@ -47,7 +48,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
if (ReferenceEquals(_callback, _callbackCompleted) ||
ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted))
{
continuation();
Task.Run(continuation);
}
}