Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -317,7 +317,7 @@ namespace System.Threading.Tasks.Tests
conTask.Wait();
Assert.True(conTask.Result, "The concurrenttask when executed successfully should have returned true");
//Now scehdule a exclusive task that is blocked(thereby preventing other concurrent tasks to finish)
//Now scehdule an exclusive task that is blocked(thereby preventing other concurrent tasks to finish)
Task<bool> exclusiveTask = writers.StartNew<bool>(() => { blockMainThreadEvent.Set(); blockExclusiveTaskEvent.WaitOne(); return true; });
//With exclusive task in execution mode, schedule a number of concurrent tasks and ensure they are not executed
@ -328,7 +328,7 @@ namespace System.Threading.Tasks.Tests
foreach (Task task in taskList)
{
bool wasTaskStarted = (task.Status != TaskStatus.Running) && (task.Status != TaskStatus.RanToCompletion);
Assert.True(wasTaskStarted, "Concurrent tasks should not be executed when a exclusive task is getting executed");
Assert.True(wasTaskStarted, "Concurrent tasks should not be executed when an exclusive task is getting executed");
}
blockExclusiveTaskEvent.Set();

View File

@ -11,7 +11,7 @@ using Xunit;
namespace System.Threading.Tasks.Tests
{
public static class CancellationTokenTests
public static partial class CancellationTokenTests
{
[Fact]
public static void CancellationTokenRegister_Exceptions()

View File

@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace System.Threading.Tasks.Tests
{
public static partial class CancellationTokenTests
{
[Fact]
public static void CancellationTokenRegistration_Token_MatchesExpectedValue()
{
Assert.Equal(default(CancellationToken), default(CancellationTokenRegistration).Token);
var cts = new CancellationTokenSource();
Assert.NotEqual(default(CancellationToken), cts.Token);
using (var ctr = cts.Token.Register(() => { }))
{
Assert.Equal(cts.Token, ctr.Token);
}
}
}
}

View File

@ -54,6 +54,7 @@
<Compile Include="Task\TaskDisposeTests.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="CancellationTokenTests.netcoreapp.cs" />
<Compile Include="Task\TaskStatusTest.netcoreapp.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

View File

@ -28,7 +28,7 @@ namespace System.Threading.Tasks.Tests
private bool _hasReturnType;
/// <summary>
/// Used to synchornize between Main thread and async thread, by blocking the main thread until
/// Used to synchronize between Main thread and async thread, by blocking the main thread until
/// the thread that invokes the TaskCompleted method via AsyncCallback finishes
/// </summary>
private ManualResetEvent _mre = new ManualResetEvent(false);

View File

@ -41,7 +41,7 @@ namespace System.Threading.Tasks.Tests
public enum WorkloadType
{
CreateChildTask, //Start a attached childTask in the workload
CreateChildTask, //Start an attached childTask in the workload
CreateDetachedChildTask, //start a detached childTask in the workload
ContinueInside, //Invoke continuewith as the workload inside the task
RunWithUserScheduler, //create a task with custom task scheduler that runs that task inline