未验证 提交 fa75057c 编写于 作者: S Steve Pfister 提交者: GitHub

[Android] Enable Dop_WorkersCreatedRespectingLimitAndTaskScheduler_Sync test (#73486)

Added a change so the test also works with only one CPU core.
Co-authored-by: NSteve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Nmdh1418 <mitchhwang1418@gmail.com>
上级 798a8018
......@@ -124,7 +124,6 @@ static IEnumerable<int> IterateUntilSet(StrongBox<bool> box)
[InlineData(2)]
[InlineData(4)]
[InlineData(128)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/50566", TestPlatforms.Android)]
public async Task Dop_WorkersCreatedRespectingLimitAndTaskScheduler_Sync(int dop)
{
static IEnumerable<int> IterateUntilSet(StrongBox<bool> box)
......@@ -141,7 +140,7 @@ static IEnumerable<int> IterateUntilSet(StrongBox<bool> box)
int activeWorkers = 0;
var block = new TaskCompletionSource();
const int MaxSchedulerLimit = 2;
int MaxSchedulerLimit = Math.Min(2, Environment.ProcessorCount);
Task t = Parallel.ForEachAsync(IterateUntilSet(box), new ParallelOptions { MaxDegreeOfParallelism = dop, TaskScheduler = new MaxConcurrencyLevelPassthroughTaskScheduler(MaxSchedulerLimit) }, async (item, cancellationToken) =>
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册