From fa75057cd0d00571ee4c433b9fd8c6476966b9d1 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Wed, 10 Aug 2022 12:19:24 -0700 Subject: [PATCH] [Android] Enable Dop_WorkersCreatedRespectingLimitAndTaskScheduler_Sync test (#73486) Added a change so the test also works with only one CPU core. Co-authored-by: Steve Pfister Co-authored-by: mdh1418 --- .../tests/ParallelForEachAsyncTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs index 304f144bad0..661df3abdbd 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs @@ -124,7 +124,6 @@ static IEnumerable IterateUntilSet(StrongBox 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 IterateUntilSet(StrongBox box) @@ -141,7 +140,7 @@ static IEnumerable IterateUntilSet(StrongBox 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) => { -- GitLab