Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// Gets the StorageInfo for the current thread.
/// </summary>
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down