Clean up left over code from port to pipelines (#1465)

- Remove unused methods in PipelineExtensions
- Remove AwaitableThreadPool since we dispatch reads
This commit is contained in:
David Fowler 2017-03-08 08:43:11 -08:00 committed by GitHub
parent 13519b6079
commit 1f0bb14546
2 changed files with 0 additions and 59 deletions

View File

@ -4,9 +4,7 @@
using System;
using System.IO.Pipelines;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
@ -48,8 +46,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
{
var result = await readingTask;
await AwaitableThreadPool.Yield();
try
{
if (!result.Buffer.IsEmpty)
@ -71,13 +67,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
}
}
private static async Task<ReadResult> ReadAsyncDispatchedAwaited(ReadableBufferAwaitable awaitable)
{
var result = await awaitable;
await AwaitableThreadPool.Yield();
return result;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Span<byte> ToSpan(this ReadableBuffer buffer)
{
@ -88,15 +77,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
return buffer.ToArray();
}
public static ArraySegment<byte> ToArraySegment(this ReadableBuffer buffer)
{
if (buffer.IsSingleSpan)
{
return buffer.First.GetArray();
}
return new ArraySegment<byte>(buffer.ToArray());
}
public static ArraySegment<byte> GetArray(this Memory<byte> memory)
{
ArraySegment<byte> result;

View File

@ -1,39 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure
{
internal static class AwaitableThreadPool
{
internal static Awaitable Yield()
{
return new Awaitable();
}
internal struct Awaitable : ICriticalNotifyCompletion
{
public void GetResult()
{
}
public Awaitable GetAwaiter() => this;
public bool IsCompleted => false;
public void OnCompleted(Action continuation)
{
Task.Run(continuation);
}
public void UnsafeOnCompleted(Action continuation)
{
OnCompleted(continuation);
}
}
}
}