Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@ -39,10 +39,10 @@ namespace System.Threading.Tasks.Tests
[SecurityCritical]
protected override void QueueTask(Task task)
{
if (task == null) throw new ArgumentNullException("When reqeusting to QueueTask, the input task can not be null");
if (task == null) throw new ArgumentNullException("When requesting to QueueTask, the input task can not be null");
Task.Factory.StartNew(() =>
{
lock (_lockObj) //Locking so that if mutliple threads in threadpool does not incorrectly increment the counter.
lock (_lockObj) //Locking so that if multiple threads in threadpool does not incorrectly increment the counter.
{
//store the current value of the counter (This becomes the unique ID for this scheduler's Task)
SchedulerID.Value = _counter;
@ -75,7 +75,7 @@ namespace System.Threading.Tasks.Tests
[SecurityCritical]
protected override IEnumerable<Task> GetScheduledTasks() { return null; }
private Object _lockObj = new Object();
private int _counter = 1; //This is used ot keep track of how many scheduler tasks were created
private int _counter = 1; //This is used to keep track of how many scheduler tasks were created
public ThreadLocal<int> SchedulerID = new ThreadLocal<int>(); //This is the ID of the scheduler.
/// <summary>The maximum concurrency level for the scheduler.</summary>
@ -136,7 +136,7 @@ namespace System.Threading.Tasks.Tests
for (int i = 0; i < 50; i++)
{
//In the current design, when there are no more tasks to execute, the Task used by concurrentexclusive scheduler dies
//by sleeping we simulate some non trival work that takes time and causes the concurrentexclusive scheduler Task
//by sleeping we simulate some non trivial work that takes time and causes the concurrentexclusive scheduler Task
//to stay around for addition work.
taskList.Add(readers.StartNew(() => { var sw = new SpinWait(); while (!sw.NextSpinWillYield) sw.SpinOnce() ; }));
}
@ -182,7 +182,7 @@ namespace System.Threading.Tasks.Tests
}
/// <summary>
/// Test to verify that only upto maxItemsPerTask are executed by a single ConcurrentExclusiveScheduler Task
/// Test to verify that only up to maxItemsPerTask are executed by a single ConcurrentExclusiveScheduler Task
/// </summary>
/// <remarks>In ConcurrentExclusiveSchedulerPair, each tasks scheduled are run under an internal Task. The basic idea for the test
/// is that each time ConcurrentExclusiveScheduler is called QueueTasK a counter (which acts as scheduler's Task id) is incremented.
@ -260,7 +260,7 @@ namespace System.Threading.Tasks.Tests
}
/// <summary>
/// When user specfices a concurrency level above the level allowed by the task scheduler, the concurrency level should be set
/// When user specifies a concurrency level above the level allowed by the task scheduler, the concurrency level should be set
/// to the concurrencylevel specified in the taskscheduler. Also tests that the maxConcurrencyLevel specified was respected
/// </summary>
[Fact]