diff options
author | Marek Safar <marek.safar@gmail.com> | 2019-01-21 00:02:09 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-01-20 15:02:09 -0800 |
commit | 9615305aac285a9e611d4768e89f7b5a251d1db8 (patch) | |
tree | 678bfb680014cc65ffed965a8acd564514a55ddd /src | |
parent | efee81505366236a22a06663fc14927a516d5655 (diff) | |
download | coreclr-9615305aac285a9e611d4768e89f7b5a251d1db8.tar.gz coreclr-9615305aac285a9e611d4768e89f7b5a251d1db8.tar.bz2 coreclr-9615305aac285a9e611d4768e89f7b5a251d1db8.zip |
Move Task factory type to shared partition (#22089)
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Private.CoreLib/System.Private.CoreLib.csproj | 2 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems | 2 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs (renamed from src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs) | 26 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskFactory.cs (renamed from src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs) | 0 |
4 files changed, 8 insertions, 22 deletions
diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj index 53ec3043fb..5f18c51a27 100644 --- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -277,10 +277,8 @@ <Compile Include="$(BclSourcesRoot)\System\Threading\Monitor.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\Overlapped.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\SynchronizationContext.cs" /> - <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\FutureFactory.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\Task.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskContinuation.cs" /> - <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskFactory.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TPLETWProvider.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\Thread.cs" /> <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPool.cs" /> diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems index 944cf62a83..5db0c043f0 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -777,11 +777,13 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\AsyncCausalityTracerConstants.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\Future.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\FutureFactory.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\ProducerConsumerQueues.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCanceledException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCompletionSource.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskExceptionHolder.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskExtensions.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskFactory.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskToApm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskScheduler.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskSchedulerException.cs" /> diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs index 3ea1792d1b..7036a71417 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs @@ -2,20 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ -// -// -// -// As with TaskFactory, TaskFactory<TResult> encodes common factory patterns into helper methods. -// -// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -using System; -using System.Security; -using System.Runtime.CompilerServices; -using System.Threading; using System.Diagnostics; -using System.Runtime.Versioning; namespace System.Threading.Tasks { @@ -543,11 +530,7 @@ namespace System.Threading.Tasks } else if (ex != null) { - bool bWonSetException = promise.TrySetException(ex); - if (bWonSetException && ex is ThreadAbortException) - { - promise.m_contingentProperties.m_exceptionsHolder.MarkAsHandled(false); - } + promise.TrySetException(ex); } else { @@ -796,7 +779,6 @@ namespace System.Threading.Tasks try { - //This is 4.5 behaviour //if we don't require synchronization, a faster set result path is taken var asyncResult = beginMethod(iar => { @@ -1250,7 +1232,7 @@ namespace System.Threading.Tasks private sealed class FromAsyncTrimPromise<TInstance> : Task<TResult> where TInstance : class { /// <summary>A cached delegate used as the callback for the BeginXx method.</summary> - internal readonly static AsyncCallback s_completeFromAsyncResult = CompleteFromAsyncResult; + internal static readonly AsyncCallback s_completeFromAsyncResult = CompleteFromAsyncResult; /// <summary>A reference to the object on which the begin/end methods are invoked.</summary> private TInstance m_thisRef; @@ -1305,6 +1287,10 @@ namespace System.Threading.Tasks /// <param name="thisRef">The target instance on which the end method should be called.</param> /// <param name="endMethod">The end method to call to retrieve the result.</param> /// <param name="asyncResult">The IAsyncResult for the async operation.</param> + /// <param name="requiresSynchronization"> + /// Whether completing the task requires synchronization. This should be true + /// unless absolutely sure that the task has not yet been handed out to any consumers. + /// </param> internal void Complete( TInstance thisRef, Func<TInstance, IAsyncResult, TResult> endMethod, IAsyncResult asyncResult, bool requiresSynchronization) diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskFactory.cs index c7281f503f..c7281f503f 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/TaskFactory.cs |