Skip to content

Commit 7e44a6a

Browse files
authored
Make the native thread pool initialization variable volatile (#46115)
- Necessary on arm32/arm64 such that if `IsInitialized()` returns true, initialized variables will also be observed correctly - Fixes #46084
1 parent 1853e26 commit 7e44a6a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/coreclr/vm/win32threadpool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int ThreadpoolMgr::ThreadAdjustmentInterval;
112112
#define GATE_THREAD_DELAY_TOLERANCE 50 /*milliseconds*/
113113
#define DELAY_BETWEEN_SUSPENDS (5000 + GATE_THREAD_DELAY) // time to delay between suspensions
114114

115-
LONG ThreadpoolMgr::Initialization=0; // indicator of whether the threadpool is initialized.
115+
Volatile<LONG> ThreadpoolMgr::Initialization = 0; // indicator of whether the threadpool is initialized.
116116

117117
bool ThreadpoolMgr::s_usePortableThreadPool = false;
118118

src/coreclr/vm/win32threadpool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ class ThreadpoolMgr
10381038
#endif // #ifndef DACCESS_COMPILE
10391039
// Private variables
10401040

1041-
static LONG Initialization; // indicator of whether the threadpool is initialized.
1041+
static Volatile<LONG> Initialization; // indicator of whether the threadpool is initialized.
10421042

10431043
static bool s_usePortableThreadPool;
10441044

0 commit comments

Comments
 (0)