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

Add boolean field to indicate whether or not the Windows thread pool is being used #90551

Merged
merged 6 commits into from
Aug 25, 2023
Merged
Changes from 1 commit
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
Expand Up @@ -13,6 +13,9 @@ public static partial class ThreadPool
internal static bool UseWindowsThreadPool { get; } =
AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.UseWindowsThreadPool", "DOTNET_ThreadPool_UseWindowsThreadPool");

// Exposes whether or not the Windows thread pool is used for diagnostics purposes
private static readonly bool s_useWindowsThreadPoolForDebugger = UseWindowsThreadPool;
Copy link
Member

@stephentoub stephentoub Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
internal static bool UseWindowsThreadPool { get; } =
AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.UseWindowsThreadPool", "DOTNET_ThreadPool_UseWindowsThreadPool");
// Exposes whether or not the Windows thread pool is used for diagnostics purposes
private static readonly bool s_useWindowsThreadPoolForDebugger = UseWindowsThreadPool;
private static readonly bool s_useWindowsThreadPool = // name relied on by sos
AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.UseWindowsThreadPool", "DOTNET_ThreadPool_UseWindowsThreadPool");
internal static bool UseWindowsThreadPool => s_useWindowsThreadPool;

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the field should reflect what the property returns because the property can be stubbed by trimming, such that sos reflects the actual state of which thread pool is being used and not just the config value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if coreclr can use trimming currently, and maybe it's not relevant currently, but I suppose it doesn't hurt to assume that either coreclr could use trimming in the future or an sos for NativeAOT could exist in the future and show similar info.


#if NATIVEAOT
private const bool IsWorkerTrackingEnabledInConfig = false;
#else
Expand Down