diff --git a/src/System.Management.Automation/engine/interpreter/Utilities.cs b/src/System.Management.Automation/engine/interpreter/Utilities.cs index de37d530749..7951554ffab 100644 --- a/src/System.Management.Automation/engine/interpreter/Utilities.cs +++ b/src/System.Management.Automation/engine/interpreter/Utilities.cs @@ -754,31 +754,6 @@ public T Update(T newValue) #region Storage implementation -#if SILVERLIGHT - private static int _cfThreadIdDispenser = 1; - - [ThreadStatic] - private static int _cfThreadId; - - private static int GetCurrentThreadId() { - if (PlatformAdaptationLayer.IsCompactFramework) { - // CF doesn't index threads by small integers, so we need to do the indexing ourselves: - int id = _cfThreadId; - if (id == 0) { - _cfThreadId = id = Interlocked.Increment(ref _cfThreadIdDispenser); - } - return id; - } else { - return Thread.CurrentThread.ManagedThreadId; - } - } -#else - private static int GetCurrentThreadId() - { - return Thread.CurrentThread.ManagedThreadId; - } -#endif - /// /// Gets the StorageInfo for the current thread. /// @@ -789,7 +764,7 @@ public StorageInfo GetStorageInfo() private StorageInfo GetStorageInfo(StorageInfo[] curStorage) { - int threadId = GetCurrentThreadId(); + int threadId = Thread.CurrentThread.ManagedThreadId; // fast path if we already have a value in the array if (curStorage != null && curStorage.Length > threadId) @@ -839,7 +814,7 @@ private StorageInfo CreateStorageInfo() StorageInfo[] curStorage = s_updating; try { - int threadId = GetCurrentThreadId(); + int threadId = Thread.CurrentThread.ManagedThreadId; StorageInfo newInfo = new StorageInfo(Thread.CurrentThread); // set to updating while potentially resizing/mutating, then we'll