Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/System.Private.CoreLib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -543,11 +530,7 @@ private static void FromAsyncCoreLogic(
}
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
{
Expand Down Expand Up @@ -796,7 +779,6 @@ internal static Task<TResult> FromAsyncImpl(Func<AsyncCallback, object, IAsyncRe

try
{
//This is 4.5 behaviour
//if we don't require synchronization, a faster set result path is taken
var asyncResult = beginMethod(iar =>
{
Expand Down Expand Up @@ -1250,7 +1232,7 @@ internal static Task<TResult> FromAsyncTrim<TInstance, TArgs>(
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;
Expand Down Expand Up @@ -1305,6 +1287,10 @@ internal static void CompleteFromAsyncResult(IAsyncResult asyncResult)
/// <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)
Expand Down