Skip to content

Commit b6fd3f7

Browse files
author
Keegan Caruso
committed
Use GetInt32ComPlusOrDotNetConfig and don't cache _stackSizeFromConfig
1 parent 2975db0 commit b6fd3f7

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.NativeAot.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private unsafe bool CreateThread(GCHandle thisThreadHandle)
9898

9999
if (stackSize <= 0)
100100
{
101-
stackSize = _stackSizeFromConfig;
101+
stackSize = GetDefaultStackSize();
102102
}
103103

104104
if (!Interop.Sys.CreateThread((IntPtr)stackSize, &ThreadEntryPoint, (IntPtr)thisThreadHandle))

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.NativeAot.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private unsafe bool CreateThread(GCHandle thisThreadHandle)
182182

183183
if (stackSize <= 0)
184184
{
185-
stackSize = _stackSizeFromConfig;
185+
stackSize = GetDefaultStackSize();
186186
}
187187

188188
if ((0 < stackSize) && (stackSize < AllocationGranularity))

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.NativeAot.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,16 @@ private static void StopThread(Thread thread)
483483
}
484484
}
485485

486-
private static int _stackSizeFromConfig = GetDefaultStackSize();
487-
488486
internal static int GetDefaultStackSize()
489487
{
490488
// Keep the same arbitrary minimum and maximum from the coreclr\vm layer.
491489
// The max was 0x80000000 (2G).
492490
// This is checked by the value being parsed into an int32.
493491
const uint minStack = 0x10000; // 64K
494492

495-
int sizeFromConfig = AppContextConfigHelper.GetInt32Config(
493+
int sizeFromConfig = AppContextConfigHelper.GetInt32ComPlusOrDotNetConfig(
496494
"System.Threading.DefaultStackSize",
497-
"DOTNET_Threading_DefaultStackSize",
495+
"Threading_DefaultStackSize",
498496
0,
499497
false);
500498

0 commit comments

Comments
 (0)