Jitted code generated for ThreadPoolWorkQueue.EnsureThreadRequested shows that the offset to the field is not cache-line separated from prior fields as requested.
Replacing the field declaration with the following seems to work as expected:
[StructLayout(LayoutKind.Sequential)]privatestructCacheLineSeparated{privatereadonlyInternal.PaddingFor32pad1;publicvolatileintnumOutstandingThreadRequests;privatereadonlyInternal.PaddingFor32pad2;}privateCacheLineSeparated_separated;
Jitted code generated for
ThreadPoolWorkQueue.EnsureThreadRequestedshows that the offset to the field is not cache-line separated from prior fields as requested.Replacing the field declaration with the following seems to work as expected: