Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix and enable a ThreadPool.CompletedWorkItemCount test and add more info about failures #57240

Merged
merged 2 commits into from
Aug 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Threading;
using System.Threading.Tests;
using Xunit;
Expand All @@ -9,11 +10,23 @@ public partial class ThreadPoolBoundHandleTests
{
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
[ActiveIssue("https://github.com/dotnet/runtime/issues/49700")]
public unsafe void MultipleOperationsOverSingleHandle_CompletedWorkItemCountTest()
{
long initialCompletedWorkItemCount = ThreadPool.CompletedWorkItemCount;
MultipleOperationsOverMultipleHandles();
ThreadTestHelpers.WaitForCondition(() => ThreadPool.CompletedWorkItemCount - initialCompletedWorkItemCount >= 2);
MultipleOperationsOverSingleHandle();
long changeInCompletedWorkItemCount = 0;
try
{
ThreadTestHelpers.WaitForCondition(() =>
{
changeInCompletedWorkItemCount = ThreadPool.CompletedWorkItemCount - initialCompletedWorkItemCount;
return changeInCompletedWorkItemCount >= 2;
});
}
catch (Exception ex)
{
// Test likely timed out, include the change for more information
throw new AggregateException($"changeInCompletedWorkItemCount: {changeInCompletedWorkItemCount}", ex);
}
}
}