From 56be9f11ca037ca4a7a6be7340a615fbdff990b1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Jun 2023 08:24:37 -0700 Subject: [PATCH] Fixed InitializeForThreadPoolThread --- .../src/System/Threading/ThreadPoolCallbackWrapper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolCallbackWrapper.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolCallbackWrapper.cs index 885db3793d524..664049c61ed4e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolCallbackWrapper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolCallbackWrapper.cs @@ -13,8 +13,10 @@ public static ThreadPoolCallbackWrapper Enter() if (!currentThread.IsThreadPoolThread) { currentThread.IsThreadPoolThread = true; +#if TARGET_WINDOWS // when using the Windows Threadpool, this is needed to increment the ThreadCount ThreadPool.InitializeForThreadPoolThread(); +#endif } return new ThreadPoolCallbackWrapper {