Skip to content

Commit

Permalink
[Android] Enable Dop_WorkersCreatedRespectingLimitAndTaskScheduler_Sy…
Browse files Browse the repository at this point in the history
…nc test (#73486)

Added a change so the test also works with only one CPU core.

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: mdh1418 <mitchhwang1418@gmail.com>
  • Loading branch information
3 people authored Aug 10, 2022
1 parent 798a801 commit fa75057
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) =>
{
Expand Down

0 comments on commit fa75057

Please sign in to comment.