Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Attempt to fix early initialization deadlock in PlatformHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara committed Feb 14, 2019
1 parent cffc32d commit da1f2cf
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

using System.Diagnostics;
using System.Runtime.CompilerServices;
using Internal.Runtime.Augments;

namespace System.Threading
Expand Down Expand Up @@ -351,6 +352,11 @@ public static bool SpinUntil(Func<bool> condition, int millisecondsTimeout)
/// <summary>
/// A helper class to get the number of processors, it updates the numbers of processors every sampling interval.
/// </summary>
#if CORERT
// The class is used from low-level lock code that participates in the lazy initialization of static constructors,
// so any static constructor in this class has to be run early.
[EagerStaticClassConstruction]
#endif
internal static class PlatformHelper
{
private const int PROCESSOR_COUNT_REFRESH_INTERVAL_MS = 30000; // How often to refresh the count, in milliseconds.
Expand Down

0 comments on commit da1f2cf

Please sign in to comment.