Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 5276f30

Browse files
davidfowljkotas
authored andcommitted
Small changes to pipelines (#27704)
- Moved CompletionData to another file and not as a nested type of Pipe - Follow the file name guidelines for tfm specific implementations
1 parent 0ce91ff commit 5276f30

File tree

7 files changed

+34
-25
lines changed

7 files changed

+34
-25
lines changed

src/System.IO.Pipelines/src/System.IO.Pipelines.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<ItemGroup>
1515
<Compile Include="Properties\InternalsVisibleTo.cs" />
1616
<Compile Include="System\IO\Pipelines\BufferSegment.cs" />
17+
<Compile Include="System\IO\Pipelines\CompletionData.cs" />
1718
<Compile Include="System\IO\Pipelines\FlushResult.cs" />
1819
<Compile Include="System\IO\Pipelines\InlineScheduler.cs" />
1920
<Compile Include="System\IO\Pipelines\IDuplexPipe.cs" />
@@ -34,13 +35,13 @@
3435
<Compile Include="System\IO\Pipelines\ThrowHelper.cs" />
3536
</ItemGroup>
3637
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
37-
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.NetCoreApp21.cs" />
38+
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.netcoreapp.cs" />
3839
</ItemGroup>
3940
<ItemGroup Condition="'$(TargetGroup)'=='netstandard1.3'">
40-
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.NetStandard13.cs" />
41+
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.netstandard1.3.cs" />
4142
</ItemGroup>
4243
<ItemGroup Condition="'$(TargetGroup)'=='netstandard'">
43-
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.NetStandard.cs" />
44+
<Compile Include="System\IO\Pipelines\ThreadPoolScheduler.netstandard.cs" />
4445
</ItemGroup>
4546
<ItemGroup>
4647
<Reference Include="System.Buffers" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Threading;
6+
7+
namespace System.IO.Pipelines
8+
{
9+
internal readonly struct CompletionData
10+
{
11+
public Action<object> Completion { get; }
12+
public object CompletionState { get; }
13+
public ExecutionContext ExecutionContext { get; }
14+
public SynchronizationContext SynchronizationContext { get; }
15+
16+
public CompletionData(Action<object> completion, object completionState, ExecutionContext executionContext, SynchronizationContext synchronizationContext)
17+
{
18+
Completion = completion;
19+
CompletionState = completionState;
20+
ExecutionContext = executionContext;
21+
SynchronizationContext = synchronizationContext;
22+
}
23+
}
24+
}

src/System.IO.Pipelines/src/System/IO/Pipelines/Pipe.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -845,21 +845,5 @@ public void Reset()
845845
ResetState();
846846
}
847847
}
848-
849-
internal readonly struct CompletionData
850-
{
851-
public Action<object> Completion { get; }
852-
public object CompletionState { get; }
853-
public ExecutionContext ExecutionContext { get; }
854-
public SynchronizationContext SynchronizationContext { get; }
855-
856-
public CompletionData(Action<object> completion, object completionState, ExecutionContext executionContext, SynchronizationContext synchronizationContext)
857-
{
858-
Completion = completion;
859-
CompletionState = completionState;
860-
ExecutionContext = executionContext;
861-
SynchronizationContext = synchronizationContext;
862-
}
863-
}
864848
}
865849
}

src/System.IO.Pipelines/src/System/IO/Pipelines/PipeAwaitable.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public CancellationTokenRegistration AttachToken(CancellationToken cancellationT
5656
}
5757

5858
[MethodImpl(MethodImplOptions.AggressiveInlining)]
59-
public void Complete(out Pipe.CompletionData completionData)
59+
public void Complete(out CompletionData completionData)
6060
{
6161
Action<object> currentCompletion = _completion;
6262
_completion = s_awaitableIsCompleted;
@@ -66,7 +66,7 @@ public void Complete(out Pipe.CompletionData completionData)
6666
if (!ReferenceEquals(currentCompletion, s_awaitableIsCompleted) &&
6767
!ReferenceEquals(currentCompletion, s_awaitableIsNotCompleted))
6868
{
69-
completionData = new Pipe.CompletionData(currentCompletion, _completionState, _executionContext, _synchronizationContext);
69+
completionData = new CompletionData(currentCompletion, _completionState, _executionContext, _synchronizationContext);
7070
}
7171
}
7272

@@ -90,7 +90,7 @@ public void Reset()
9090
}
9191
}
9292

93-
public void OnCompleted(Action<object> continuation, object state, ValueTaskSourceOnCompletedFlags flags, out Pipe.CompletionData completionData, out bool doubleCompletion)
93+
public void OnCompleted(Action<object> continuation, object state, ValueTaskSourceOnCompletedFlags flags, out CompletionData completionData, out bool doubleCompletion)
9494
{
9595
completionData = default;
9696

@@ -120,18 +120,18 @@ public void OnCompleted(Action<object> continuation, object state, ValueTaskSour
120120

121121
if (ReferenceEquals(awaitableState, s_awaitableIsCompleted))
122122
{
123-
completionData = new Pipe.CompletionData(continuation, state, _executionContext, _synchronizationContext);
123+
completionData = new CompletionData(continuation, state, _executionContext, _synchronizationContext);
124124
return;
125125
}
126126

127127
if (!ReferenceEquals(awaitableState, s_awaitableIsNotCompleted))
128128
{
129129
doubleCompletion = true;
130-
completionData = new Pipe.CompletionData(continuation, state, _executionContext, _synchronizationContext);
130+
completionData = new CompletionData(continuation, state, _executionContext, _synchronizationContext);
131131
}
132132
}
133133

134-
public void Cancel(out Pipe.CompletionData completionData)
134+
public void Cancel(out CompletionData completionData)
135135
{
136136
Complete(out completionData);
137137
_canceledState = completionData.Completion == null ?

src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.NetCoreApp21.cs renamed to src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.netcoreapp.cs

File renamed without changes.

src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.NetStandard.cs renamed to src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.netstandard.cs

File renamed without changes.

src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.NetStandard13.cs renamed to src/System.IO.Pipelines/src/System/IO/Pipelines/ThreadPoolScheduler.netstandard1.3.cs

File renamed without changes.

0 commit comments

Comments
 (0)