1228 references to Interlocked
mscorlib (254)
parent\parent\parent\parent\InternalApis\NDP_Common\inc\PinnableBufferCache.cs (2)
117int numAllocCalls = Interlocked.Increment(ref m_numAllocCalls); 122int previousNumAllocCalls = Interlocked.Exchange(ref m_numAllocCalls, 0);
system\collections\arraylist.cs (1)
161System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\bitarray.cs (1)
421System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\Collections\Concurrent\ConcurrentQueue.cs (9)
315Interlocked.Increment(ref m_numSnapshotTakers); 345Interlocked.Decrement(ref m_numSnapshotTakers); 475Interlocked.Increment(ref m_numSnapshotTakers); 566Interlocked.Decrement(ref m_numSnapshotTakers); 624Interlocked.Increment(ref m_numSnapshotTakers); 631Interlocked.Decrement(ref m_numSnapshotTakers); 637Interlocked.Decrement(ref m_numSnapshotTakers); 797newhigh = Interlocked.Increment(ref m_high); 831if (Interlocked.CompareExchange(ref m_low, lowLocal + 1, lowLocal) == lowLocal)
system\Collections\Concurrent\ConcurrentStack.cs (5)
359if (Interlocked.CompareExchange(ref m_head, newNode, newNode.m_next) == newNode.m_next) 431if (Interlocked.CompareExchange(ref m_head, head, tail.m_next) == tail.m_next) 459while (Interlocked.CompareExchange( 556if (Interlocked.CompareExchange(ref m_head, head.m_next, head) == head) 706if (Interlocked.CompareExchange(ref m_head, next.m_next, head) == head)
system\collections\concurrent\PartitionerStatic.cs (6)
672Interlocked.Increment(ref m_activeCopiers); 674int endPos = Interlocked.Add(ref m_FillBufferCurrentPosition, requestedChunkSize); 685Interlocked.Decrement(ref m_activeCopiers); 932Interlocked.Increment(ref m_activePartitionCount.Value); 1006if (m_activePartitionCount != null && Interlocked.Decrement(ref m_activePartitionCount.Value) == 0) 1157if (Interlocked.CompareExchange(ref m_sharedIndex.Value, newSharedIndex, oldSharedIndex)
system\collections\generic\dictionary.cs (1)
594System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\generic\list.cs (1)
167System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\hashtable.cs (2)
1124System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null); 1692Interlocked.CompareExchange(ref s_SerializationInfoTable, newTable, null);
system\collections\listdictionaryinternal.cs (1)
125System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\objectmodel\collection.cs (1)
167System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\objectmodel\readonlycollection.cs (1)
112System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\objectmodel\readonlydictionary.cs (3)
293System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null); 442System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null); 541System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null);
system\collections\queue.cs (1)
112System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
system\collections\sortedlist.cs (1)
272System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\collections\stack.cs (1)
85System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
system\console.cs (2)
119Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null); 138Interlocked.CompareExchange<Object>(ref s_ReadKeySyncObject, o, null);
system\currenttimezone.cs (1)
164Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\diagnostics\eventing\activitytracker.cs (4)
115id = Interlocked.Increment(ref m_nextId); 117id = Interlocked.Increment(ref currentActivity.m_lastChildID); 202if (Interlocked.CompareExchange(ref activityToStop.m_stopped, 1, 0) == 0) 409uint id = unchecked((uint)Interlocked.Increment(ref ancestor.m_lastChildID)); // Get a unique ID
system\diagnostics\eventing\eventsource.cs (5)
1266Interlocked.CompareExchange(ref m_eventData[eventId].TraceLoggingEventTypes, tlet, null); 1991Interlocked.CompareExchange(ref m_eventData[eventId].TraceLoggingEventTypes, tlet, null); 2071Interlocked.CompareExchange(ref m_eventData[eventId].TraceLoggingEventTypes, eventTypes, null); 4580Interlocked.CompareExchange(ref s_EventSources, new List<WeakReference>(2), null); 5442while (Interlocked.CompareExchange(ref af.m_curSampleCount, newSampleCount, curSampleCount) != curSampleCount);
System\Diagnostics\Eventing\TraceLogging\ConcurrentSet.cs (2)
2using Interlocked = System.Threading.Interlocked; 109newItems = Interlocked.CompareExchange(ref this.items, newItems, oldItems);
System\Diagnostics\Eventing\TraceLogging\NameInfo.cs (3)
3using Interlocked = System.Threading.Interlocked; 29if (Interlocked.CompareExchange(ref lastIdentity, newIdentity, snapshot) == snapshot) 44this.identity = Interlocked.Increment(ref lastIdentity);
System\Diagnostics\Eventing\TraceLogging\SimpleEventTypes.cs (2)
2using Interlocked = System.Threading.Interlocked; 42Interlocked.CompareExchange(ref instance, newInstance, null);
System\Diagnostics\Eventing\TraceLogging\TraceLoggingEventTypes.cs (1)
3using Interlocked = System.Threading.Interlocked;
System\Diagnostics\Eventing\TraceLogging\TraceLoggingTypeInfo_T.cs (2)
3using Interlocked = System.Threading.Interlocked; 146Interlocked.CompareExchange(ref instance, newInstance, null);
system\diagnostics\stacktrace.cs (1)
190Interlocked.CompareExchange(ref s_getSourceLineInfo, getSourceLineInfo, null);
system\environment.cs (1)
256Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\gc.cs (1)
601(Interlocked.CompareExchange(ref _handle, IntPtr.Zero, temp) == temp))
system\globalization\cultureinfo.cs (1)
1002Interlocked.CompareExchange<CultureInfo>(ref m_parent, culture, null);
system\io\filestream.cs (3)
215if (Interlocked.CompareExchange<ManualResetEvent>(ref _waitHandle, mre, null) == null) { 2137if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) 2392if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0))
system\io\unmanagedmemorystream.cs (29)
313return Interlocked.Read(ref _length); 328return Interlocked.Read(ref _position); 344Interlocked.Exchange(ref _position, value); 357long pos = Interlocked.Read(ref _position); 377Interlocked.Exchange(ref _position, value - _mem); 408long pos = Interlocked.Read(ref _position); 409long len = Interlocked.Read(ref _length); 441Interlocked.Exchange(ref _position, pos + n); 481long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition 482long len = Interlocked.Read(ref _length); 485Interlocked.Exchange(ref _position, pos + 1); 518Interlocked.Exchange(ref _position, offset); 522long pos = Interlocked.Read(ref _position); 525Interlocked.Exchange(ref _position, offset + pos); 529long len = Interlocked.Read(ref _length); 532Interlocked.Exchange(ref _position, len + offset); 539long finalPos = Interlocked.Read(ref _position); 557long pos = Interlocked.Read(ref _position); 558long len = Interlocked.Read(ref _length); 564Interlocked.Exchange(ref _length, value); 566Interlocked.Exchange(ref _position, value); 585long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition 586long len = Interlocked.Read(ref _length); 607Interlocked.Exchange(ref _length, n); 637Interlocked.Exchange(ref _position, n); 678long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition 679long len = Interlocked.Read(ref _length); 700Interlocked.Exchange(ref _length, n); 724Interlocked.Exchange(ref _position, n);
system\Lazy.cs (1)
361Interlocked.CompareExchange(ref m_boxed, boxed, null) != null)
system\marshalbyrefobject.cs (1)
153Interlocked.CompareExchange(ref __identity, id, null);
system\multicastdelegate.cs (1)
198if (a[index] == null && System.Threading.Interlocked.CompareExchange<Object>(ref a[index], o, null) == null)
system\reflection\assembly.cs (2)
1321Interlocked.CompareExchange<object>(ref m_syncRoot, new object(), null); 1451Interlocked.CompareExchange<string>(ref m_fullname, s, null);
system\reflection\ConstructorInfo.cs (1)
303RemotingMethodCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null);
system\reflection\fieldinfo.cs (1)
266RemotingFieldCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null);
system\reflection\methodinfo.cs (1)
289RemotingMethodCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null);
system\reflection\parameterinfo.cs (1)
794RemotingParameterCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null);
system\rttype.cs (4)
1648existingCache = Interlocked.CompareExchange(ref m_cache, newCache, null); 1834Interlocked.CompareExchange(ref s_methodInstantiationsLock, new Object(), null); 1953RemotingTypeCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null); 2748IntPtr gcHandle = Interlocked.CompareExchange(ref m_cache, newgcHandle, (IntPtr)0);
system\runtime\interopservices\gchandle.cs (1)
112if (handle != IntPtr.Zero && Interlocked.CompareExchange(ref m_handle, IntPtr.Zero, handle) == handle)
system\runtime\interopservices\windowsruntime\eventregistrationtokentable.cs (1)
254Interlocked.CompareExchange(ref refEventTable, new EventRegistrationTokenTable<T>(), null);
system\runtime\interopservices\windowsruntime\windowsruntimemarshal.cs (5)
472int newCount = Interlocked.Increment(ref _count); 483int newCount = Interlocked.Decrement(ref _count); 1000if (Interlocked.CompareExchange(ref myLock, 1, 0) != 0) 1013if (Interlocked.CompareExchange(ref myLock, 1, 0) == 0) 1245if (Interlocked.CompareExchange(ref s_pClassActivator, pActivator, IntPtr.Zero) != IntPtr.Zero)
system\runtime\memoryfailpoint.cs (1)
108return Interlocked.Add(ref hiddenLastKnownFreeAddressSpace, addend);
system\runtime\remoting\context.cs (1)
111_ctxID = Interlocked.Increment(ref _ctxIDCounter);
system\runtime\remoting\identity.cs (7)
256if(currentFlags == Interlocked.CompareExchange(ref _flags, newFlags, currentFlags)) 268if(currentFlags == Interlocked.CompareExchange(ref _flags, newFlags, currentFlags)) 299if(currentFlags == Interlocked.CompareExchange(ref _flags, newFlags, currentFlags)) 363Interlocked.CompareExchange(ref _tpOrObject, tpObj, null); 385Interlocked.CompareExchange(ref _objRef, objRefGiven, null); 405Interlocked.CompareExchange( 445Interlocked.CompareExchange(
system\runtime\remoting\lifetimeservices.cs (1)
70Interlocked.CompareExchange(ref s_LifetimeSyncObject, o, null);
system\runtime\remoting\message.cs (3)
240Interlocked.CompareExchange(ref _properties, 946Interlocked.CompareExchange(ref _properties, properties, null); 1312Interlocked.CompareExchange(ref _properties, properties, null);
system\runtime\remoting\serveridentity.cs (1)
260if (_tpOrObject != null && _firstCallDispatched == 0 && Interlocked.CompareExchange(ref _firstCallDispatched, 1, 0) == 0)
system\runtime\remoting\trackingservices.cs (1)
58Interlocked.CompareExchange(ref s_TrackingServicesSyncObject, o, null);
system\runtime\serialization\formatters\binary\binaryobjectinfo.cs (1)
897roi.objectInfoId = Interlocked.Increment(ref readObjectInfoCounter);
system\runtime\serialization\serializationfieldinfo.cs (1)
158RemotingFieldCachedData ret = Interlocked.CompareExchange(ref m_cachedData, cache, null);
system\security\cryptography\cryptoconfig.cs (1)
108Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
system\security\namedpermissionset.cs (1)
208Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
system\security\policy\applicationsecurityinfo.cs (4)
60Interlocked.CompareExchange(ref m_appId, appId, null); 77Interlocked.CompareExchange(ref m_deployId, deplId, null); 151Interlocked.CompareExchange(ref m_defaultRequest, defaultRequest, null); 182Interlocked.CompareExchange(ref m_appEvidence, appEvidence, null);
system\security\policy\applicationtrust.cs (2)
349Interlocked.CompareExchange(ref s_installReference, 383Interlocked.CompareExchange(ref m_appTrusts, appTrusts, null);
system\security\policy\hashmembershipcondition.cs (1)
38Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
system\security\policy\policylevel.cs (1)
77Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
system\security\policymanager.cs (1)
51Interlocked.CompareExchange(ref m_policyLevels, policyLevels, null);
system\security\principal\windowsidentity.cs (1)
589Interlocked.CompareExchange(ref m_groups, groups, null);
system\sharedstatics.cs (2)
127return Interlocked.Increment(ref _sharedStatics._Remoting_Identity_IDSeqNum); 140return Interlocked.Add(ref _sharedStatics._memFailPointReservedMemory, (long) size);
system\text\dbcscodepageencoding.cs (1)
253Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\decoderbestfitfallback.cs (1)
79Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\decoderfallback.cs (1)
32Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\encoderbestfitfallback.cs (1)
79Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\encoderfallback.cs (1)
33Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\encoding.cs (1)
399Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\text\sbcscodepageencoding.cs (1)
148Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\threading\CancellationTokenSource.cs (9)
189if (Interlocked.CompareExchange(ref m_kernelEvent, mre, null) != null) 487if (Interlocked.CompareExchange(ref m_timer, newTimer, null) != null) 675registeredCallbacksLists = Interlocked.CompareExchange(ref m_registeredCallbacksLists, list, null); 684Interlocked.CompareExchange(ref (registeredCallbacksLists[myIndex]), callBackArray, null); 723if (Interlocked.CompareExchange(ref m_state, NOTIFYING, NOT_CANCELED) == NOT_CANCELED) 765Interlocked.Exchange(ref m_state, NOTIFYINGCOMPLETE); 1122if (curr.m_elements[tryIndex] == null && Interlocked.CompareExchange(ref curr.m_elements[tryIndex], element, null) == null) 1140if (Interlocked.CompareExchange(ref tail.m_next, newTail, null) == null) 1226T prevailingValue = Interlocked.CompareExchange(ref m_elements[index], null, expectedElement);
system\threading\CountdownEvent.cs (3)
199int newCount = Interlocked.Decrement(ref m_currentCount); 256if (Interlocked.CompareExchange(ref m_currentCount, observedCount - signalCount, observedCount) == observedCount) 370if (Interlocked.CompareExchange(ref m_currentCount, observedCount + signalCount, observedCount) == observedCount)
system\threading\interlocked.cs (1)
247return Interlocked.CompareExchange(ref location,0,0);
system\threading\LazyInitializer.cs (2)
154Interlocked.CompareExchange(ref target, value, null); 229slock = Interlocked.CompareExchange(ref syncLock, newLock, null);
system\threading\ManualResetEventSlim.cs (3)
265Interlocked.CompareExchange(ref m_lock, newObj, null); // failure is benign.. someone else won the ----. 282if (Interlocked.CompareExchange(ref m_eventObj, newEventObj, null) != null) 782if (Interlocked.CompareExchange(ref m_combinedState, newState, oldState) == oldState)
system\threading\SpinLock.cs (11)
170Interlocked.CompareExchange(ref m_owner, observedOwner | LOCK_ANONYMOUS_OWNED, observedOwner, ref lockTaken) != observedOwner) //acquiring the lock failed 270Interlocked.CompareExchange(ref m_owner, observedOwner | LOCK_ANONYMOUS_OWNED, observedOwner, ref lockTaken) != observedOwner) // acquiring the lock failed 350if (Interlocked.CompareExchange(ref m_owner, observedOwner | 1, observedOwner, ref lockTaken) == observedOwner) 363turn = (Interlocked.Add(ref m_owner, 2) & WAITERS_MASK) >> 1 ; 406if (Interlocked.CompareExchange(ref m_owner, newOwner, observedOwner, ref lockTaken) == observedOwner) 448if (Interlocked.CompareExchange(ref m_owner, newOwner, observedOwner, ref lockTaken) == observedOwner) 500if (Interlocked.CompareExchange(ref m_owner, observedOwner - 2, observedOwner) == observedOwner) 552if (Interlocked.CompareExchange(ref m_owner, m_newOwner, lockUnowned, ref lockTaken) == lockUnowned) 590Interlocked.Decrement(ref m_owner); 652Interlocked.Exchange(ref m_owner, LOCK_UNOWNED); 654Interlocked.Decrement(ref m_owner);
system\threading\Tasks\BeginEndAwaitableAdapter.cs (2)
86Action continuation = Interlocked.Exchange(ref adapter._continuation, CALLBACK_RAN); 136|| Interlocked.CompareExchange(ref _continuation, continuation, null) == CALLBACK_RAN) {
system\threading\Tasks\Future.cs (1)
483Interlocked.Exchange(ref m_stateFlags, m_stateFlags | TASK_STATE_RAN_TO_COMPLETION);
system\threading\Tasks\Parallel.cs (6)
253forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID); 292int myIndex = Interlocked.Increment(ref actionIndex); // = index to use + 1 313myIndex = Interlocked.Increment(ref actionIndex); 1099forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID); 1414forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID); 3228forkJoinContextID = Interlocked.Increment(ref s_forkJoinContextID);
system\threading\Tasks\ParallelLoopState.cs (6)
223while (Interlocked.CompareExchange( 266while (Interlocked.CompareExchange( 442if (Interlocked.CompareExchange(ref m_LoopStateFlags, oldState | newState, oldState) == oldState) 503else return Interlocked.Read(ref rval); 558else return Interlocked.Read(ref m_lowestBreakIteration); 571else return Interlocked.Read(ref m_lowestBreakIteration);
system\threading\Tasks\ParallelRangeManager.cs (5)
114Interlocked.CompareExchange(ref m_indexRanges[m_nCurrentIndexRange].m_nSharedCurrentIndexOffset, new Shared<long>(0), null); 128nMyOffset = Interlocked.Add(ref *(int*)indexPtr, (int)m_nIncrementValue) - m_nIncrementValue; 134nMyOffset = Interlocked.Add(ref m_indexRanges[m_nCurrentIndexRange].m_nSharedCurrentIndexOffset.Value, m_nIncrementValue) - m_nIncrementValue; 165Interlocked.Exchange(ref m_indexRanges[m_nCurrentIndexRange].m_bRangeFinished, 1); 304int nInitialRange = (Interlocked.Increment(ref m_nCurrentIndexRangeToAssign) - 1) % m_indexRanges.Length;
system\threading\Tasks\Task.cs (24)
820if (Interlocked.CompareExchange(ref m_stateFlags, oldFlags | newBits, oldFlags) == oldFlags) 835if (Interlocked.CompareExchange(ref m_stateFlags, oldFlags | newBits, oldFlags) == oldFlags) 871if (Interlocked.CompareExchange(ref m_stateFlags, newFlags, oldFlags) == oldFlags) break; 1018Interlocked.Increment(ref props.m_completionCountdown); 1030Interlocked.Decrement(ref props.m_completionCountdown); 1099if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null) 1201if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null) 1307newId = Interlocked.Increment(ref s_taskIdCounter); 1332Interlocked.CompareExchange(ref m_taskId, newId, 0); 1674if (Interlocked.CompareExchange(ref contingentProps.m_completionEvent, newMre, null) != null) 2032if (Interlocked.CompareExchange(ref props.m_exceptionsHolder, holder, null) != null) 2231Interlocked.Decrement(ref props.m_completionCountdown) == 0) // Reaching this sub clause means there may be remaining active children, 2323Interlocked.Exchange(ref m_stateFlags, m_stateFlags | completionState); 2383Interlocked.CompareExchange(ref props.m_exceptionalChildren, new List<Task>(), null); 2401if (Interlocked.Decrement(ref props.m_completionCountdown) == 0) 2760int prevState = Interlocked.Exchange(ref m_stateFlags, m_stateFlags | TASK_STATE_CANCELED); 3547Interlocked.Exchange(ref m_stateFlags, m_stateFlags | TASK_STATE_CANCELED); 3597object continuationObject = Interlocked.Exchange(ref m_continuationObject, s_taskCompletionSentinel); 4743Interlocked.CompareExchange(ref m_continuationObject, newList, oldValue); 4800if ((m_continuationObject != null) || (Interlocked.CompareExchange(ref m_continuationObject, tc, null) != null)) 4825if (Interlocked.CompareExchange(ref m_continuationObject, new List<object>(), continuationObject) != continuationObject) 5235if (Interlocked.Decrement(ref _count) == 0) Set(); 6129if (Interlocked.Decrement(ref m_count) == 0) 6373if (Interlocked.Decrement(ref m_count) == 0)
system\threading\Tasks\TaskExceptionHolder.cs (1)
81Interlocked.CompareExchange( ref s_adUnloadEventHandler,
system\threading\Tasks\TaskFactory.cs (3)
1660if (Interlocked.Decrement(ref _count) == 0) 1738if (Interlocked.Decrement(ref _count) == 0) 2436if (Interlocked.CompareExchange(ref m_firstTaskAlreadyCompleted, 1, 0) == 0)
system\threading\Tasks\TaskScheduler.cs (3)
324Interlocked.CompareExchange(ref s_activeTaskSchedulers, new ConditionalWeakTable<TaskScheduler, object>(), null); 413newId = Interlocked.Increment(ref s_taskSchedulerIdCounter); 416Interlocked.CompareExchange(ref m_taskSchedulerId, newId, 0);
system\threading\thread.cs (3)
1204Interlocked.CompareExchange(ref s_asyncLocalCurrentUICulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentUICulture), null); 1315Interlocked.CompareExchange(ref s_asyncLocalCurrentCulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentCulture), null); 1798Interlocked.CompareExchange(ref s_LocalDataStoreMgr, new LocalDataStoreMgr(), null);
system\threading\threadpool.cs (10)
309Interlocked.Exchange(ref m_tailIndex, tail); 382Interlocked.Exchange(ref m_headIndex, head + 1); 462int prevIndexes = Interlocked.CompareExchange(ref indexes, newIndexes, oldIndexes); 583int prev = Interlocked.CompareExchange(ref numOutstandingThreadRequests, count+1, count); 605int prev = Interlocked.CompareExchange(ref numOutstandingThreadRequests, count - 1, count); 634Interlocked.CompareExchange(ref head.Next, new QueueSegment(), null); 638Interlocked.CompareExchange(ref queueHead, head.Next, head); 684Interlocked.CompareExchange(ref queueTail, tail.Next, tail); 1005if (Interlocked.CompareExchange(ref m_lock, 1, 0) == 0) 1074if (Interlocked.CompareExchange(ref m_lock, 1, 0) == 0)
system\threading\volatile.cs (6)
128return Interlocked.CompareExchange(ref location, 0, 0); 145return (ulong)Interlocked.CompareExchange(ref *(long*)pLocation, 0, 0); 197return Interlocked.CompareExchange(ref location, 0, 0); 306Interlocked.Exchange(ref location, value); 329Interlocked.Exchange(ref *(long*)pLocation, (long)value); 378Interlocked.Exchange(ref location, value);
system\timezone.cs (1)
44Interlocked.CompareExchange<Object>(ref s_InternalSyncObject, o, null);
system\type.cs (1)
273Interlocked.CompareExchange<Binder>(ref defaultBinder, binder, null);
PresentationCore (10)
Core\CSharp\MS\Internal\FontCache\BufferCache.cs (6)
40if (Interlocked.Increment(ref _mutex) == 1) 44Interlocked.Decrement(ref _mutex); 169if (Interlocked.Increment(ref _mutex) == 1) 179Interlocked.Decrement(ref _mutex); 197if (Interlocked.Increment(ref _mutex) == 1) 210Interlocked.Decrement(ref _mutex);
Core\CSharp\System\Windows\Media\MediaContext.cs (1)
2098uint renderID = (uint)Interlocked.Increment(ref _contextRenderID);
Core\CSharp\System\Windows\Media\SafeMILHandleMemoryPressure.cs (2)
38Interlocked.Increment(ref _refCount); 47if (Interlocked.Decrement(ref _refCount) == 0)
Core\CSharp\System\Windows\Media\TextFormatting\TextFormatterContext.cs (1)
555System.Threading.Interlocked.CompareExchange<Dictionary<char,bool>>(ref _specialCharacters, dict, null);
PresentationFramework (22)
src\Framework\MS\Internal\Data\CollectionViewProxy.cs (2)
176IndexedEnumerable indexer = (IndexedEnumerable) Interlocked.Exchange(ref _indexer, null); 1065Interlocked.CompareExchange(ref _indexer, newIndexer, null);
src\Framework\MS\Internal\Data\DataBindEngine.cs (3)
446if (Interlocked.Increment(ref _cleanupRequests) == 1) 610Interlocked.Exchange(ref _cleanupRequests, 0); 634HybridDictionary asyncDispatchers = (HybridDictionary)Interlocked.Exchange(ref _asyncDispatchers, null);
src\Framework\MS\Internal\PtsHost\FlowDocumentPage.cs (1)
830if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
src\Framework\MS\Internal\PtsHost\PageBreakRecord.cs (1)
144if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
src\Framework\MS\Internal\PtsHost\PtsCache.cs (2)
187if (0 == Interlocked.CompareExchange(ref _disposed, 1, 0)) 340if (0 == Interlocked.CompareExchange(ref _disposed, 1, 0))
src\Framework\MS\Internal\PtsHost\PtsContext.cs (1)
93if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
src\Framework\MS\Internal\PtsHost\PtsPage.cs (1)
781if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
src\Framework\MS\Internal\Utility\MonitorWrapper.cs (2)
29Interlocked.Increment(ref _enterCount); 35int count = Interlocked.Decrement(ref _enterCount);
src\Framework\MS\Win32\UxThemeWrapper.cs (1)
219ThemeState currentState = System.Threading.Interlocked.CompareExchange(ref _themeState, newState, themeState);
src\Framework\System\Windows\Data\BindingOperations.cs (2)
589Interlocked.CompareExchange<ExceptionLogger>(ref _exceptionLogger, newLogger, null); 616Interlocked.CompareExchange<ExceptionLogger>(ref _exceptionLogger, null, this);
src\Framework\System\Windows\Data\CollectionView.cs (2)
1452IndexedEnumerable wrapper = (IndexedEnumerable) Interlocked.Exchange(ref _enumerableWrapper, null); 1768Interlocked.CompareExchange(ref _enumerableWrapper, newWrapper, null);
src\Framework\System\Windows\Documents\WpfPayload.cs (1)
340int newWpfPayoutCount = Interlocked.Increment(ref _wpfPayloadCount);
src\Framework\System\Windows\FrameworkElementFactory.cs (1)
1181Interlocked.Increment(ref AutoGenChildNamePostfix);
src\Framework\System\Windows\StyleHelper.cs (1)
5345Interlocked.Increment(ref lastChildIndex);
src\Framework\System\Windows\SystemResources.cs (1)
844string currentName = System.Threading.Interlocked.CompareExchange(ref _themedResourceName, themedResourceName, null);
SMSvcHost (8)
System\ServiceModel\Activation\ActivatedMessageQueue.cs (1)
46Interlocked.Increment(ref listenerChannelIdCounter), Guid.NewGuid());
System\ServiceModel\Activation\ListenerAdapter.cs (3)
97Interlocked.Exchange(ref closingProcessStatus, ClosingProcessBlocked); 99Interlocked.Exchange(ref closingProcessStatus, ClosingProcessUnBlocked); 783int currentClosingProcessStatus = Interlocked.CompareExchange(ref closingProcessStatus,
System\ServiceModel\Activation\ListenerAdapterBase.cs (1)
227if (Interlocked.Increment(ref closed) > 1)
System\ServiceModel\Activation\MsmqActivation.cs (2)
323Interlocked.Increment(ref queueIdCounter), Guid.Empty); 610if (Interlocked.Exchange(ref disposed, 1) == 0)
System\ServiceModel\Activation\WorkerProcess.cs (1)
67if (Interlocked.Increment(ref isUnregistered) == 1)
System (235)
compmod\microsoft\win32\SafeNativeMethods.cs (1)
176return Interlocked.CompareExchange(ref *(int *)pDestination.ToPointer(), exchange, compare);
compmod\system\collections\generic\linkedlist.cs (1)
391System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
compmod\system\collections\generic\queue.cs (1)
103System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
compmod\system\collections\generic\sortedlist.cs (1)
365System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
compmod\system\collections\generic\sortedset.cs (1)
319System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
compmod\system\collections\generic\stack.cs (1)
104System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
compmod\system\collections\specialized\listdictionary.cs (1)
154System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
compmod\system\collections\specialized\nameobjectcollectionbase.cs (1)
525System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
compmod\system\collections\specialized\ordereddictionary.cs (1)
146System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null);
compmod\system\componentmodel\TypeDescriptor.cs (3)
1908int ci = System.Threading.Interlocked.Increment(ref _collisionIndex) - 1; 2944Interlocked.Increment(ref _metadataVersion); 3012Interlocked.Increment(ref _metadataVersion);
net\System\Net\_AutoWebProxyScriptEngine.cs (1)
751int currentVersion = Interlocked.Increment(ref s_CurrentVersion);
net\System\Net\_ChunkParser.cs (1)
164if (Interlocked.CompareExchange(ref this.userBuffer, userBuffer, null) != null)
net\System\Net\_Connection.cs (2)
1379int currentCount = Interlocked.Decrement(ref m_ReservedCount); 1554int currentCount = Interlocked.Increment(ref m_ReservedCount);
net\System\Net\_ConnectionGroup.cs (1)
88Interlocked.CompareExchange(ref m_Event, new ManualResetEvent(false), null);
net\System\Net\_ConnectStream.cs (20)
173Interlocked.CompareExchange<Exception>(ref m_ErrorException, new IOException(SR.GetString(SR.net_io_readfailure, SR.GetString(SR.net_io_connectionclosed))), null); 389if ( Interlocked.Increment( ref m_DoneCalled) == 1 ) 621Interlocked.CompareExchange(ref m_CallNesting, Nesting.InternalIO, Nesting.Idle); 693Interlocked.CompareExchange(ref m_CallNesting, Nesting.Idle, Nesting.InternalIO); 921int nesting = Interlocked.CompareExchange(ref m_CallNesting, Nesting.IoInProgress, Nesting.Idle); 1161nesting = Interlocked.CompareExchange(ref m_CallNesting, (nesting == Nesting.InError? Nesting.InError: Nesting.Idle), Nesting.IoInProgress); 1264Interlocked.CompareExchange<Exception>(ref m_ErrorException, userException, null); 1276int result = Interlocked.CompareExchange(ref m_CallNesting, value, comparand); 1408int nesting = Interlocked.CompareExchange(ref m_CallNesting, Nesting.IoInProgress, Nesting.Idle); 1437Interlocked.CompareExchange(ref m_CallNesting, Nesting.Idle, Nesting.IoInProgress); 1679int nesting = Interlocked.CompareExchange(ref m_CallNesting, Nesting.IoInProgress, Nesting.Idle); 1997Interlocked.CompareExchange(ref m_CallNesting, Nesting.Idle, Nesting.IoInProgress); 2181Interlocked.CompareExchange(ref m_CallNesting, Nesting.InternalIO, Nesting.Idle); 2229Interlocked.CompareExchange(ref m_CallNesting, Nesting.Idle, Nesting.InternalIO); 2521if (Interlocked.Exchange(ref m_ShutDown, AlreadyAborted) >= AlreadyAborted) { 2529if (Interlocked.Increment(ref m_ShutDown) > 1) { 2544if (Interlocked.Exchange(ref m_CallNesting, nesting) == Nesting.IoInProgress) 2690if (!aborting && Interlocked.Exchange(ref m_ShutDown, AlreadyAborted) >= AlreadyAborted){ 3038Interlocked.CompareExchange<Exception>(ref m_ErrorException, new IOException(Msg), null); 3042willThrow &= Interlocked.CompareExchange<Exception>(ref m_ErrorException, exception, null) != null;
net\System\Net\_LazyAsyncResult.cs (6)
164Interlocked.CompareExchange(ref m_IntCompleted, c_HighBit, 0); 191if (Interlocked.CompareExchange(ref m_Event, waitHandle, null) == null) 246result = Interlocked.CompareExchange(ref m_IntCompleted, c_HighBit, 0); 271result = Interlocked.CompareExchange(ref m_IntCompleted, c_HighBit, 0); 347if ((m_IntCompleted & ~c_HighBit) == 0 && (Interlocked.Increment(ref m_IntCompleted) & ~c_HighBit) == 1) 532if ((m_IntCompleted & ~c_HighBit) == 0 && (Interlocked.Increment(ref m_IntCompleted) & ~c_HighBit) == 1)
net\System\Net\_NTAuthentication.cs (1)
349m_UniqueUserId = (Interlocked.Increment(ref s_UniqueGroupId)).ToString(NumberFormatInfo.InvariantInfo) + m_UniqueUserId;
net\System\Net\_PooledStream.cs (6)
462int newValue = Interlocked.Increment(ref m_SynchronousIOClosingState); 472if (ServicePointManager.UseSafeSynchronousClose && ClosingFlag == Interlocked.Decrement(ref m_SynchronousIOClosingState)) { 495int newValue = Interlocked.Increment(ref m_SynchronousIOClosingState); 505if (ServicePointManager.UseSafeSynchronousClose && ClosingFlag == Interlocked.Decrement(ref m_SynchronousIOClosingState)) { 557if (oldValue == Interlocked.CompareExchange(ref location1, oldValue | bitMask, oldValue)) { 574if (ClosingFlag == Interlocked.CompareExchange(ref m_SynchronousIOClosingState, ClosedFlag, ClosingFlag)) {
net\System\Net\_SafeNetHandles.cs (6)
299if (Interlocked.Increment(ref _disposed) == 1) { 341if (Interlocked.Increment(ref disposed) == 1) { 380if (Interlocked.Increment(ref disposed) == 1) { 2380IntPtr oldHandle = Interlocked.Exchange(ref handle, IntPtr.Zero); 2507InnerSafeCloseSocket innerSocket = m_InnerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref m_InnerSocket, null); 2526InnerSafeCloseSocket innerSocket = m_InnerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref m_InnerSocket, null);
net\System\Net\_SSPISessionCache.cs (2)
44int index = Interlocked.Increment(ref _Current) & c_MaxCacheSize; 45newRef = Interlocked.Exchange<SafeCredentialReference>(ref _CacheSlots[index], newRef);
net\System\Net\_TimerThread.cs (6)
609return Interlocked.Exchange(ref cancelled, 1) == 0; 618TimerThreadState oldState = (TimerThreadState) Interlocked.CompareExchange( 649if (Interlocked.CompareExchange(ref s_ThreadState, (int) TimerThreadState.Running, (int) TimerThreadState.Running) != 717Interlocked.CompareExchange(ref s_ThreadState, (int) TimerThreadState.Idle, (int) TimerThreadState.Running); 720if (Interlocked.CompareExchange(ref s_ThreadState, (int) TimerThreadState.Running, (int) TimerThreadState.Idle) == 789Interlocked.Exchange(ref s_ThreadState, (int) TimerThreadState.Stopped);
net\System\Net\_TLSstream.cs (1)
103if ( Interlocked.Exchange( ref m_ShutDown, 1) == 1 ) {
net\System\Net\Cache\_CacheStreams.cs (14)
126if (Interlocked.Increment(ref m_ReadNesting) != 1) { 145Interlocked.Decrement(ref m_ReadNesting); 216if (Interlocked.Increment(ref m_ReadNesting) != 1) { 256Interlocked.Decrement(ref m_ReadNesting); 263if (Interlocked.Decrement(ref m_ReadNesting) != 0) { 264Interlocked.Increment(ref m_ReadNesting); 443if (Interlocked.Increment(ref m_ReadNesting) != 1) { 500Interlocked.Decrement(ref m_ReadNesting); 668if (Interlocked.Increment(ref m_ReadNesting) != 1) { 697Interlocked.Decrement(ref m_ReadNesting); 704if (Interlocked.Decrement(ref m_ReadNesting) != 0) { 705Interlocked.Increment(ref m_ReadNesting); 754if (Interlocked.Increment(ref _Disposed) == 1) { 999if (Interlocked.Increment(ref _Disposed) == 1) {
net\System\Net\Cache\IERequestCache.cs (2)
719if (Interlocked.Exchange(ref m_Disposed, 1) == 0) 943if (Interlocked.Exchange(ref m_Disposed, 1) == 0 && m_Entry != null) {
net\System\Net\Configuration\AuthenticationModulesSection.cs (1)
126Interlocked.CompareExchange(ref classSyncObject, o, null);
net\System\Net\Configuration\ConnectionManagementSection.cs (1)
71Interlocked.CompareExchange(ref classSyncObject, o, null);
net\System\Net\Configuration\DefaultProxySection.cs (1)
285Interlocked.CompareExchange(ref classSyncObject, o, null);
net\System\Net\Configuration\RequestCachingSection.cs (1)
235Interlocked.CompareExchange(ref classSyncObject, o, null);
net\System\Net\Configuration\SettingsSection.cs (1)
214Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
net\System\Net\Configuration\SmtpSection.cs (1)
215Interlocked.CompareExchange(ref classSyncObject, new object(), null);
net\System\Net\Configuration\WebRequestModulesSection.cs (1)
99Interlocked.CompareExchange(ref classSyncObject, o, null);
net\System\Net\connectionpool.cs (5)
510Interlocked.Decrement(ref m_WaitCount); 518int newWaitCount = Interlocked.Decrement(ref m_WaitCount); 536Interlocked.Decrement(ref m_WaitCount); 568Interlocked.Decrement(ref m_WaitCount); 609Interlocked.Increment(ref m_WaitCount);
net\System\Net\ConnectionPoolManager.cs (1)
28Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
net\System\Net\filewebrequest.cs (1)
518if (Interlocked.Increment(ref m_Aborted) == 1)
net\System\Net\HttpListener.cs (5)
2558Interlocked.CompareExchange<DigestContext[]>(ref m_SavedDigests, new DigestContext[MaximumDigests], null); 2728while ((oldValue = Interlocked.CompareExchange(ref m_OwnershipState, 1, 0)) == 2) 2741if (Interlocked.CompareExchange(ref m_OwnershipState, 0, 1) == 2) 2756if (Interlocked.Exchange(ref asyncResult.m_OwnershipState, 2) == 0) 2803int oldValue = Interlocked.Exchange(ref m_OwnershipState, 3);
net\System\Net\HttpWebRequest.cs (9)
2109object returnResult = Interlocked.Exchange(ref m_PendingReturnResult, DBNull.Value); 2340object oldResult = Interlocked.CompareExchange(ref m_PendingReturnResult, pendResult, null); 2361object oldResult = Interlocked.CompareExchange(ref m_PendingReturnResult, NclConstants.Sentinel, null); 3140if(Interlocked.CompareExchange(ref m_Aborted, abortState, 0) == 0) // public abort will never drain streams 3528object responseData = Async? Interlocked.CompareExchange(ref _CoreResponse, null, DBNull.Value): _CoreResponse; 3578object responseData = Interlocked.CompareExchange(ref _CoreResponse, responseOrException, DBNull.Value); 3672responseData = Interlocked.CompareExchange(ref _CoreResponse, responseOrException, null); 6299return (Interlocked.Increment(ref s_UniqueGroupId)).ToString(NumberFormatInfo.InvariantInfo); 6416Interlocked.Exchange(ref isAborted, 1);
net\System\Net\Internal.cs (7)
407Interlocked.CompareExchange(ref _LocalAddressesLock, new object(), null); 466int gate = Interlocked.CompareExchange(ref m_State, Triggered, Open); 483int gate = Interlocked.CompareExchange(ref m_State, Triggering, Open); 495int gate = Interlocked.CompareExchange(ref m_State, Triggered, Triggering); 511int gate = Interlocked.CompareExchange(ref m_State, Signaling, Triggered); 524int gate = Interlocked.CompareExchange(ref m_State, Signaled, Signaling); 535int gate = Interlocked.CompareExchange(ref m_State, Completed, Signaled);
net\System\Net\Logging.cs (1)
62Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
net\System\Net\mail\ClosableStream.cs (1)
29if (Interlocked.Increment(ref closed) == 1)
net\System\Net\mail\MimeMultiPart.cs (1)
213int b = Interlocked.Increment(ref boundary) - 1;
net\System\Net\mail\MultiAsyncResult.cs (2)
41if (System.Threading.Interlocked.Decrement(ref this.outstanding) == -1) 49System.Threading.Interlocked.Increment(ref this.outstanding);
net\System\Net\NetworkInformation\ping.cs (2)
86int currentStatus = Interlocked.CompareExchange(ref status, InProgress, Free); 135if (Interlocked.CompareExchange(ref status, Disposed, Free) != Free)
net\System\Net\SecureProtocols\_HelperAsyncResults.cs (2)
133int status = Interlocked.Exchange(ref _CompletionStatus, StatusCompleted); 147int status = Interlocked.Exchange(ref _CompletionStatus, StatusCheckedOnSyncCompletion);
net\System\Net\SecureProtocols\_NegoState.cs (2)
384if (Interlocked.Exchange(ref _NestedAuth, 1) == 1) { 429if (Interlocked.Exchange(ref _NestedAuth, 0) == 0)
net\System\Net\SecureProtocols\_NegoStream.cs (2)
126if (Interlocked.Exchange(ref _NestedWrite, 1) == 1) 209if (Interlocked.Exchange(ref _NestedRead, 1) == 1)
net\System\Net\SecureProtocols\_SslState.cs (12)
173targetHost = "?" + Interlocked.Increment(ref UniqueNameInteger).ToString(NumberFormatInfo.InvariantInfo); 396Interlocked.CompareExchange<_SslStream>(ref _SecureStream, new _SslStream(this), null); 561if (Interlocked.Exchange(ref _NestedAuth, 1) == 1) { 705if (Interlocked.Exchange(ref _NestedAuth, 0) == 0) 1127int lockState = Interlocked.Exchange(ref _LockReadState, LockHandshake); 1155int lockState = Interlocked.Exchange(ref _LockReadState, newState); 1187int lockState = Interlocked.CompareExchange(ref _LockReadState, LockRead, LockNone); 1235int lockState = Interlocked.CompareExchange(ref _LockReadState, LockNone, LockRead); 1267int lockState = Interlocked.CompareExchange(ref _LockWriteState, LockWrite, LockNone); 1302int lockState = Interlocked.CompareExchange(ref _LockWriteState, LockNone, LockWrite); 1359int lockState = Interlocked.Exchange(ref _LockWriteState, LockHandshake); 1394int lockState = Interlocked.CompareExchange(ref _LockWriteState, LockNone, LockHandshake);
net\System\Net\SecureProtocols\_SslStream.cs (5)
149if (Interlocked.Exchange(ref _NestedRead, 0) == 0) 201if (Interlocked.Exchange(ref _NestedWrite, 0) == 0) 329if (Interlocked.Exchange(ref _NestedWrite, 1) == 1) 383if (Interlocked.Exchange(ref _NestedWrite, 1) == 1) 648if (Interlocked.Exchange(ref _NestedRead, 1) == 1)
net\System\Net\SecureProtocols\NegotiateStream.cs (2)
611if (Interlocked.Exchange(ref _NestedRead, 0) == 0) 680if (Interlocked.Exchange(ref _NestedWrite, 0) == 0)
net\System\Net\Sockets\_BaseOverlappedAsyncResult.cs (6)
231m_Cache = overlappedCache == null ? null : Interlocked.Exchange<OverlappedCache>(ref overlappedCache, null); 277OverlappedCache cache = m_Cache == null ? null : Interlocked.Exchange<OverlappedCache>(ref m_Cache, null); 289OverlappedCache oldCache = Interlocked.Exchange<OverlappedCache>(ref overlappedCache, cache); 585if (Interlocked.Decrement(ref m_CleanupCount) == 0) { 595if (m_CleanupCount > 0 && Interlocked.Exchange(ref m_CleanupCount, 0) > 0) 748OverlappedCache cache = overlappedCache == null ? null : Interlocked.Exchange<OverlappedCache>(ref overlappedCache, null);
net\System\Net\Sockets\Socket.cs (18)
2742if (Interlocked.Exchange(ref asyncConnectOperationLock, 1) != 0) 2784Interlocked.Exchange(ref asyncConnectOperationLock, 0); 2915if (Interlocked.Exchange(ref m_RegisteredWait, null) == null) 3100if (Interlocked.Exchange(ref asyncConnectOperationLock, 1) != 0) 3114Interlocked.Exchange(ref asyncConnectOperationLock, 0); 3169if (Interlocked.Exchange(ref asyncConnectOperationLock, 1) != 0) 3194Interlocked.Exchange(ref asyncConnectOperationLock, 0); 3338Interlocked.Exchange(ref asyncConnectOperationLock, 0); 5675Interlocked.CompareExchange(ref s_InternalSyncObject, o, null); 5802Interlocked.CompareExchange(ref m_AcceptQueueOrConnectResult, new Queue(16), null); 6253while ((last = Interlocked.CompareExchange(ref m_IntCleanedUp, 1, 0)) == 2) 7524Interlocked.CompareExchange<ManualResetEvent>(ref m_AsyncEvent, new ManualResetEvent(false), null); 7532if (Interlocked.CompareExchange(ref m_IntCleanedUp, 2, 0) != 0) 7548Interlocked.Exchange(ref m_IntCleanedUp, 0); 7594if (Interlocked.Exchange(ref me.m_RegisteredWait, null) != null) 8966if(Interlocked.CompareExchange(ref m_Operating, Disposed, Free) != Free) { 8986int status = Interlocked.CompareExchange(ref m_Operating, Configuring, Free); 9001if(Interlocked.CompareExchange(ref m_Operating, InProgress, Free) != Free) {
net\System\Net\webclient.cs (3)
92if (AnotherCallInProgress(Interlocked.Increment(ref m_CallNesting))) { 110Interlocked.Decrement(ref m_CallNesting); 1764if ((object)Interlocked.CompareExchange<AsyncOperation>(ref m_AsyncOp, null, asyncOp) == (object) asyncOp)
net\System\Net\WebRequest.cs (1)
84Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
net\System\Net\WebSockets\ClientWebSocket.cs (3)
136int priorState = Interlocked.CompareExchange(ref state, connecting, created); 176if (Interlocked.CompareExchange(ref state, connected, connecting) != connecting) 370int priorState = Interlocked.Exchange(ref state, disposed);
net\System\Net\WebSockets\WebSocketBase.cs (4)
1440if (Interlocked.CompareExchange<Exception>(ref m_PendingException, exception, null) == null) 1452Exception pendingException = Interlocked.Exchange<Exception>(ref m_PendingException, null); 1470if ((receiveState = Interlocked.Exchange(ref m_ReceiveState, newReceiveState)) != expectedReceiveState) 1913int originalReceiveState = Interlocked.CompareExchange(ref m_WebSocket.m_ReceiveState,
net\System\Net\WebSockets\WebSocketBuffer.cs (3)
122if (Interlocked.CompareExchange(ref m_StateWhenDisposing, (int)webSocketState, int.MinValue) != int.MinValue) 199int previousState = Interlocked.Exchange(ref m_SendBufferState, SendBufferState.SendPayloadSpecified); 303int previousState = Interlocked.Exchange(ref m_SendBufferState, SendBufferState.None);
net\System\Net\WebSockets\WebSocketConnectionStream.cs (1)
552if (Interlocked.Increment(ref m_CleanedUp) == 1)
net\System\Net\WebSockets\WebSocketHttpListenerDuplexStream.cs (4)
668if (disposing && Interlocked.Exchange(ref m_CleanedUp, 1) == 0) 1003if (Interlocked.CompareExchange(ref m_Operating, Disposed, Free) != Free) 1062if (Interlocked.CompareExchange(ref m_Operating, InProgress, Free) != Free) 1184Interlocked.Exchange(ref m_Operating, Free);
net\System\URI.cs (1)
969Interlocked.CompareExchange(ref s_initLock, o, null);
parent\parent\parent\InternalApis\NDP_Common\inc\PinnableBufferCache.cs (2)
117int numAllocCalls = Interlocked.Increment(ref m_numAllocCalls); 122int previousNumAllocCalls = Interlocked.Exchange(ref m_numAllocCalls, 0);
regex\system\text\regularexpressions\Regex.cs (4)
1491if (0 == Interlocked.Exchange(ref _locked, 1)) { 1540if (0 == Interlocked.Exchange(ref _locked, 1)) { 1571if (0 == Interlocked.Exchange(ref _locked, 1)) { 1587if (0 == Interlocked.Exchange(ref _locked, 1)) {
regex\system\text\regularexpressions\RegexCompiler.cs (2)
3139int typenum = Interlocked.Increment(ref _typeCount); 3426int regexnum = Interlocked.Increment(ref _regexCount);
services\io\system\io\FileSystemWatcher.cs (2)
997Interlocked.Increment(ref currentSession); 1046Interlocked.Increment(ref currentSession);
services\monitoring\system\diagnosticts\EventLogInternal.cs (2)
115Interlocked.CompareExchange(ref m_InstanceLockObject, o, null); 127Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
services\monitoring\system\diagnosticts\PerformanceCounter.cs (1)
61Interlocked.CompareExchange(ref m_InstanceLockObject, o, null);
services\monitoring\system\diagnosticts\PerformanceCounterLib.cs (2)
66Interlocked.CompareExchange(ref s_InternalSyncObject, o, null); 610Interlocked.CompareExchange(ref this.customCategoryTable, new Hashtable(StringComparer.OrdinalIgnoreCase), null);
services\monitoring\system\diagnosticts\ProcessManager.cs (2)
1075long[] buffer = Interlocked.Exchange(ref CachedBuffer, null); 1115Interlocked.Exchange(ref CachedBuffer, buffer);
services\monitoring\system\diagnosticts\SharedPerformanceCounter.cs (4)
516int r = Interlocked.CompareExchange(ref *spinLockPointer, 1, 0); 1450return Interlocked.Add(ref counterEntry->Value, addend); 1457return Interlocked.Decrement(ref counterEntry->Value); 1478return Interlocked.Increment(ref counterEntry->Value);
services\monitoring\system\diagnosticts\SharedUtils.cs (1)
37Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
sys\system\collections\concurrent\BlockingCollection.cs (3)
476if (Interlocked.CompareExchange(ref m_currentAdders, observedAdders + 1, observedAdders) == observedAdders) 531Interlocked.Decrement(ref m_currentAdders); 1509if (Interlocked.CompareExchange(ref m_currentAdders, observedAdders | COMPLETE_ADDING_ON_MASK, observedAdders) == observedAdders)
sys\system\collections\concurrent\ConcurrentBag.cs (2)
155Interlocked.Exchange(ref list.m_currentOp, (int)ListOperation.Add); 240Interlocked.Exchange(ref list.m_currentOp, (int)ListOperation.Take);
sys\System\IO\compression\DeflaterZLib.cs (1)
219if (Interlocked.Exchange(ref _isValid, 0) != 0) {
sys\System\IO\compression\DeflateStream.cs (5)
389Interlocked.Increment(ref asyncOperations); 420Interlocked.Decrement( ref asyncOperations); 653Interlocked.Increment(ref asyncOperations); 667Interlocked.Decrement(ref asyncOperations); 734Interlocked.Decrement(ref asyncOperations);
sys\System\IO\compression\DeflateStreamAsyncResult.cs (3)
55Interlocked.CompareExchange(ref m_Event, new ManualResetEvent(savedCompleted != 0), null); 114Interlocked.Increment(ref m_Completed); 120if (Interlocked.Increment(ref m_InvokedCallback) == 1) {
sys\system\io\ports\SerialStream.cs (4)
962if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) 1033if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) 1785if (Interlocked.Decrement(ref asyncResult._numBytes) == 0) 1806if (Interlocked.Decrement(ref asyncResult._numBytes) == 0)
sys\system\runtime\interopservices\handlecollector.cs (2)
69Interlocked.Increment( ref handleCount); 98Interlocked.Decrement( ref handleCount);
sys\system\threading\Barrier.cs (1)
289return Interlocked.CompareExchange(ref m_currentTotalCount, newCurrentTotal, currentTotal) == currentTotal;
System.Activities (8)
Microsoft\VisualBasic\Activities\VisualBasicHelper.cs (1)
100Interlocked.CompareExchange(ref HostedCompilerCache,
Microsoft\VisualBasic\Activities\XamlIntegration\VisualBasicExpressionConverter.cs (1)
228Interlocked.CompareExchange(ref xmlnsMappings,
System\Activities\Activity.cs (2)
898Interlocked.CompareExchange(ref nextCacheId, 1, int.MaxValue); 899this.cacheId = Interlocked.Increment(ref nextCacheId);
System\Activities\Hosting\WorkflowInstance.cs (1)
585wasPerformingOperation = Interlocked.CompareExchange(ref this.isPerformingOperation, True, False) == True;
System\Activities\Runtime\CallbackWrapper.cs (1)
288Interlocked.CompareExchange(ref ReflectionMemberAccessPermissionSet, myPermissionSet, null);
System\Activities\WorkflowApplicationInstance.cs (2)
121int oldState = Interlocked.CompareExchange(ref this.state, (int)State.Loaded, (int)State.Initialized); 127int oldState = Interlocked.CompareExchange(ref this.state, (int)State.Aborted, (int)State.Initialized);
System.AddIn (2)
System\Addin\Hosting\AddInServer.cs (2)
72Interlocked.Increment(ref _addInAppDomains); 87long val = Interlocked.Decrement(ref _addInAppDomains);
System.Configuration (2)
System\Configuration\BaseConfigurationRecord.cs (1)
3379Interlocked.CompareExchange(ref s_appConfigPath, appConfigPath, null);
System\Configuration\SafeBitVector32.cs (1)
46int result = Interlocked.CompareExchange(ref _data, newData, oldData);
System.Core (45)
Microsoft\Scripting\Actions\CallSiteBinder.cs (1)
219Interlocked.CompareExchange(ref Cache, new Dictionary<Type, object>(), null);
Microsoft\Scripting\Ast\BlockExpression.cs (1)
167Interlocked.CompareExchange(
Microsoft\Scripting\Ast\Expression.cs (3)
78Interlocked.CompareExchange( 273Interlocked.CompareExchange<IList<T>>( 301Interlocked.CompareExchange(
Microsoft\Scripting\Compiler\AssemblyGen.cs (2)
53Interlocked.CompareExchange(ref _assembly, new AssemblyGen(), null); 109int index = Interlocked.Increment(ref _index);
Microsoft\Scripting\Compiler\LambdaCompiler.cs (1)
308return _typeBuilder.DefineField("<ExpressionCompilerImplementationDetails>{" + Interlocked.Increment(ref _Counter) + "}" + name, type, FieldAttributes.Static | FieldAttributes.Private);
Microsoft\Scripting\Compiler\LambdaCompiler.Lambda.cs (1)
146return "<ExpressionCompilerImplementationDetails>{" + Interlocked.Increment(ref _Counter) + "}lambda_method";
Microsoft\Scripting\Utils\ReadOnlyCollectionBuilder.cs (1)
369System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
Microsoft\Win32\SafeHandles\SafePerfProviderHandle.cs (1)
23if (Interlocked.Exchange(ref handle, IntPtr.Zero) != IntPtr.Zero) {
System\Diagnostics\Eventing\EventProvider.cs (1)
152if (Interlocked.Exchange(ref m_disposed, 1) != 0)
System\Diagnostics\PerformanceData\CounterSet.cs (2)
82Interlocked.Decrement(ref m_provider.m_counterSet); 247Interlocked.Increment(ref m_provider.m_counterSet);
System\Diagnostics\PerformanceData\CounterSetInstance.cs (1)
100if (Interlocked.Exchange(ref m_active, 0) != 0) {
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (6)
45return Interlocked.Read(ref (* m_offset)); 51Interlocked.Exchange(ref (* m_offset), value); 59Interlocked.Increment (ref (*m_offset)); 66Interlocked.Decrement (ref (*m_offset)); 73Interlocked.Add (ref (*m_offset), value); 172if (Interlocked.Exchange(ref m_disposed, 1) == 0) {
System\Diagnostics\PerformanceData\PerfProviderCollection.cs (1)
49Interlocked.CompareExchange(ref s_hiddenInternalSyncObject, o, null);
System\IO\BufferedStream2.cs (7)
119Interlocked.Increment(ref _pendingBufferCopy); 120int newPos = Interlocked.Add(ref _writePos, count); 125Interlocked.Decrement(ref _pendingBufferCopy); 149Interlocked.CompareExchange(ref _buffer, new byte[bufferSize], null); 154Interlocked.Decrement(ref _pendingBufferCopy); 610Interlocked.Exchange(ref pos, value); 616return Interlocked.Add(ref pos, posDelta);
System\IO\Pipes\Pipe.cs (1)
731if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) {
System\IO\Pipes\PipeStream.cs (2)
380if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) { 582if (1 == Interlocked.CompareExchange(ref afsar._EndXxxCalled, 1, 0)) {
System\Linq\Parallel\Channels\AsynchronousChannel.cs (4)
308Interlocked.Exchange(ref m_producerBufferIndex, (bufferIndex + 1) % m_buffer.Length); 346Interlocked.Exchange(ref m_producerIsWaiting, 1); 565Interlocked.Exchange(ref m_consumerIsWaiting, 1); 627Interlocked.Exchange(ref m_consumerBufferIndex, (consumerBufferIndex + 1) % m_buffer.Length);
System\Linq\Parallel\Partitioning\PartitionedDataSource.cs (1)
728if (Interlocked.Decrement(ref m_activeEnumeratorsCount.Value) == 0)
System\Linq\Parallel\QueryOperators\Unary\DefaultIfEmptyQueryOperator.cs (1)
186Interlocked.Increment(ref m_sharedEmptyCount.Value);
System\Linq\Parallel\QueryOperators\Unary\SingleQueryOperator.cs (1)
161Interlocked.Increment(ref m_totalElementCount.Value);
System\Linq\Parallel\Scheduling\QueryTaskGroupState.cs (1)
96if (Interlocked.Exchange(ref m_alreadyEnded, 1) == 0)
System\Linq\Parallel\Utils\PLINQETWProvider.cs (1)
52return Interlocked.Increment(ref s_queryId);
system\threading\ReaderWriterLockSlim\ReaderWriterLockSlim.cs (4)
147_lockID = Interlocked.Increment(ref s_nextLockID); 1637return Interlocked.CompareExchange(ref _isLocked, 1, 0) == 0; 1654Interlocked.Add(ref _enterDeprioritizationState, deprioritizationStateChange); 1679Interlocked.Add(ref _enterDeprioritizationState, -deprioritizationStateChange);
System.Data (107)
fx\src\data\System\Data\Common\DataAdapter.cs (1)
37internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Common\DbConnectionStringBuilder.cs (1)
39internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Common\SafeNativeMethods.cs (1)
63actualPtr = Interlocked.CompareExchange(ref *(IntPtr *)lpAddress.ToPointer(), lpValue, previousPtr);
fx\src\data\System\Data\DataColumn.cs (1)
89private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataRelation.cs (1)
84private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataRelationCollection.cs (1)
38private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataRow.cs (1)
45internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataSet.cs (1)
92private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataTable.cs (2)
177private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 1165view = Interlocked.CompareExchange<DataView>(ref defaultView, view, null);
fx\src\data\System\Data\DataTableCollection.cs (1)
40private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\DataView.cs (1)
103private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Odbc\OdbcCommand.cs (1)
37internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Odbc\OdbcDataReader.cs (1)
56internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Odbc\OdbcEnvironment.cs (1)
39object globalEnvironmentHandle = Interlocked.Exchange(ref _globalEnvironmentHandle, null);
fx\src\data\System\Data\OleDb\OleDbCommand.cs (2)
42internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 509UnsafeNativeMethods.ICommandText ict = Interlocked.Exchange<UnsafeNativeMethods.ICommandText>(ref _icommandText, null);
fx\src\data\System\Data\OleDb\OleDbDataReader.cs (1)
30internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\OleDb\OleDbTransaction.cs (1)
31internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\ProviderBase\DbConnectionFactory.cs (1)
30internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\Data\System\Data\ProviderBase\DbConnectionHelper.cs (3)
33internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 157Interlocked.CompareExchange(ref _innerConnection, DbConnectionClosedPreviouslyOpened.SingletonInstance, innerConnection); 365bool result = (from == Interlocked.CompareExchange<DbConnectionInternal>(ref _innerConnection, to, from));
fx\src\data\System\Data\ProviderBase\DbConnectionInternal.cs (3)
30internal readonly int _objectID = Interlocked.Increment(ref _objectTypeCount); 129previousTransactionClone = Interlocked.Exchange(ref _enlistedTransaction, valueClone); 591SysTx.Transaction enlistedTransaction = Interlocked.Exchange(ref _enlistedTransaction, null);
fx\src\data\System\Data\ProviderBase\DbConnectionPool.cs (15)
76internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 461internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 1083started = Interlocked.CompareExchange(ref _pendingOpensWaiting, 1, 0) == 0; 1164Interlocked.Exchange(ref _pendingOpensWaiting, 0); 1238Interlocked.Increment(ref _waitCount); 1275Interlocked.Decrement(ref _waitCount); 1282Interlocked.Decrement(ref _waitCount); 1293Interlocked.Decrement(ref _waitCount); 1301Interlocked.Decrement(ref _waitCount); 1327Interlocked.Decrement(ref _waitCount); 1359Interlocked.Decrement(ref _waitCount); 1364Interlocked.Decrement(ref _waitCount); 1368Interlocked.Decrement(ref _waitCount); 1372Interlocked.Decrement(ref _waitCount); 1376Interlocked.Decrement(ref _waitCount);
fx\src\data\System\Data\ProviderBase\DbConnectionPoolAuthenticationContext.cs (2)
95int oldValue = Interlocked.CompareExchange(ref _isUpdateInProgress, STATUS_LOCKED, STATUS_UNLOCKED); 104int oldValue = Interlocked.CompareExchange(ref _isUpdateInProgress, STATUS_UNLOCKED, STATUS_LOCKED);
fx\src\data\System\Data\ProviderBase\DbConnectionPoolGroup.cs (1)
45internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\Selection.cs (1)
95private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlBulkCopy.cs (1)
255internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlCommand.cs (3)
47internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 3078Interlocked.CompareExchange(ref _reconnectionCompletionSource, null, completion); 4364Interlocked.CompareExchange(ref _reconnectionCompletionSource, null, completion);
fx\src\data\System\Data\SqlClient\SqlCommandSet.cs (1)
31internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlConnection.cs (3)
1215Interlocked.CompareExchange(ref _asyncWaitingForReconnection, waitingTask, null); 1279Interlocked.CompareExchange<Task>(ref _currentReconnectionTask, null, runningReconnect); 1702Interlocked.CompareExchange(ref _asyncWaitingForReconnection, null, asyncWaitingForReconnection);
fx\src\data\System\Data\SqlClient\SqlDataReader.cs (8)
75internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 3953Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4021Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4113Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4264Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4384Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4485Task original = Interlocked.CompareExchange(ref _currentTask, source.Task, null); 4659Task current = Interlocked.CompareExchange(ref _currentTask, null, source.Task);
fx\src\data\System\Data\SqlClient\SqlDelegatedTransaction.cs (1)
22private readonly int _objectID = Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlDependency.cs (1)
265private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlDependencyListener.cs (4)
75private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 480int result = Interlocked.Increment(ref _startCount); // Add to refCount. 782int result = Interlocked.Decrement(ref _startCount); 1241private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlDependencyUtils.cs (1)
88private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\SqlInternalConnectionSmi.cs (1)
237int wasInUse = System.Threading.Interlocked.Exchange(ref _isInUse, 1);
fx\src\data\System\Data\SqlClient\SqlInternalConnectionTds.cs (3)
681TdsParser parser = Interlocked.Exchange(ref _parser, null); // guard against multiple concurrent dispose calls -- Delegated Transactions might cause this. 911Interlocked.Decrement(ref _asyncCommandCount); 915Interlocked.Increment(ref _asyncCommandCount);
fx\src\data\System\Data\SqlClient\sqlinternaltransaction.cs (3)
48internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 305Int32 openResultCount = Interlocked.Decrement(ref _openResultCount); 351Int32 openResultCount = Interlocked.Increment(ref _openResultCount);
fx\src\data\System\Data\SqlClient\SqlSequentialStream.cs (2)
166Task original = Interlocked.CompareExchange<Task>(ref _currentTask, completion.Task, null); 258Interlocked.CompareExchange(ref _currentTask, null, completion.Task);
fx\src\data\System\Data\SqlClient\SqlSequentialTextReader.cs (2)
140Task original = Interlocked.CompareExchange<Task>(ref _currentTask, completion.Task, null); 262Interlocked.CompareExchange(ref _currentTask, null, completion.Task);
fx\src\data\System\Data\SqlClient\SqlTransaction.cs (1)
22internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\TdsParser.cs (3)
32internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 376int result = Interlocked.Increment(ref _nonTransactedOpenResultCount); 384Interlocked.Decrement(ref _nonTransactedOpenResultCount);
fx\src\data\System\Data\SqlClient\TdsParserSessionPool.cs (1)
33private readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
fx\src\data\System\Data\SqlClient\TdsParserStateObject.cs (22)
42internal readonly int _objectID = System.Threading.Interlocked.Increment(ref _objectTypeCount); 566int result = Interlocked.Increment(ref _activateCount); // must have non-zero activation count for reclaimation to work too. 799int result = Interlocked.Decrement(ref _activateCount); // must have non-zero activation count for reclaimation to work too. 821int remaining = Interlocked.Decrement(ref _pendingCallbacks); 917int remaining = Interlocked.Increment(ref _pendingCallbacks); 1949Interlocked.Increment(ref _readingCount); 1959Interlocked.Decrement(ref _readingCount); 1985Interlocked.Decrement(ref _readingCount); 2156Interlocked.Increment(ref _readingCount); 2170Interlocked.Decrement(ref _readingCount); 2294Interlocked.Increment(ref _readingCount); 2301Interlocked.Decrement(ref _readingCount); 2330Interlocked.Increment(ref _readingCount); 2340Interlocked.Decrement(ref _readingCount); 2355Interlocked.Decrement(ref _readingCount); 2582var delayedException = Interlocked.Exchange(ref _delayedWriteAsyncCallbackException, null); 2611Interlocked.Decrement(ref _asyncWriteCount); 2670var delayedException = Interlocked.Exchange(ref _delayedWriteAsyncCallbackException, null); 2693delayedException = Interlocked.Exchange(ref _delayedWriteAsyncCallbackException, null); 2889var delayedException = Interlocked.Exchange(ref _delayedWriteAsyncCallbackException, null); 2923Interlocked.Increment(ref _asyncWriteCount); 2934delayedException = Interlocked.Exchange(ref _delayedWriteAsyncCallbackException, null);
fx\src\data\System\Data\SQLTypes\SQLFileStream.cs (1)
32internal readonly int ObjectID = System.Threading.Interlocked.Increment(ref _objectTypeCount);
System.Data.Entity (50)
System\Data\Common\Utils\AliasGenerator.cs (1)
81System.Threading.Interlocked.CompareExchange(ref _prefixCounter, updatedCache, prefixCounter);
System\Data\Common\Utils\Singleton.cs (1)
52Interlocked.CompareExchange(ref this.value, newValue, null);
System\Data\Mapping\StorageMappingItemLoader.cs (1)
3360System.Threading.Interlocked.CompareExchange(ref s_mappingXmlSchema, set, null);
System\Data\Mapping\Update\Internal\UpdateCommand.cs (2)
232this.m_orderingIdentifier = Interlocked.Increment(ref s_orderingIdentifierCounter); 236other.m_orderingIdentifier = Interlocked.Increment(ref s_orderingIdentifierCounter);
System\Data\Metadata\Edm\AssociationEndMember.cs (1)
53Interlocked.CompareExchange(ref _getRelatedEndMethod, value, null);
System\Data\Metadata\Edm\AssociationType.cs (1)
65Interlocked.CompareExchange(ref _associationEndMembers,
System\Data\Metadata\Edm\ComplexType.cs (2)
69Interlocked.CompareExchange(ref _properties, 135Interlocked.CompareExchange(ref _constructor, value, null);
System\Data\Metadata\Edm\EdmProperty.cs (2)
132Interlocked.CompareExchange(ref _memberGetter, value, null); 144Interlocked.CompareExchange(ref _memberSetter, value, null);
System\Data\Metadata\Edm\EdmType.cs (1)
285Interlocked.CompareExchange<CollectionType>(ref _collectionType, new CollectionType(this), null);
System\Data\Metadata\Edm\EntitySet.cs (2)
168Interlocked.CompareExchange(ref _foreignKeyDependents, readOnlyDependents, null); 169Interlocked.CompareExchange(ref _foreignKeyPrincipals, readOnlyPrincipals, null);
System\Data\Metadata\Edm\EntityType.cs (5)
160Interlocked.CompareExchange(ref _properties, 178Interlocked.CompareExchange<RefType>(ref _referenceType, new RefType(this), null); 192Interlocked.CompareExchange<RowType>(ref _keyRow, new RowType(keyProperties), null); 266Interlocked.CompareExchange(ref _constructor, value, null); 295Interlocked.CompareExchange(ref _hash, BuildEntityTypeHash(), null);
System\Data\Metadata\Edm\FacetDescription.cs (3)
211Interlocked.CompareExchange(ref _defaultValueFacet, defaultValueFacet, null); 227Interlocked.CompareExchange(ref _nullValueFacet, nullValueFacet, null); 261System.Threading.Interlocked.CompareExchange(
System\Data\Metadata\Edm\ItemCollection.cs (2)
69Interlocked.CompareExchange(ref _functionLookUpTable, functionLookUpTable, null); 203Interlocked.CompareExchange(ref _itemsCache, itemsCache, currentValueForItemCache);
System\Data\Metadata\Edm\MetadataCollection.cs (1)
388CollectionData swappedOutData = Interlocked.CompareExchange<CollectionData>(ref _collectionData, newData, originalData);
System\Data\Metadata\Edm\MetadataItem.cs (1)
98System.Threading.Interlocked.CompareExchange<MetadataCollection<MetadataProperty>>(
System\Data\Metadata\Edm\NavigationPropertyAccessor.cs (5)
64Interlocked.CompareExchange(ref _memberGetter, value, null); 76Interlocked.CompareExchange(ref _memberSetter, value, null); 87Interlocked.CompareExchange(ref _collectionAdd, value, null); 98Interlocked.CompareExchange(ref _collectionRemove, value, null); 109Interlocked.CompareExchange(ref _collectionCreate, value, null);
System\Data\Metadata\Edm\Provider\ClrProviderManifest.cs (1)
227Interlocked.CompareExchange<System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType>>(ref _primitiveTypes, readOnlyTypes, null);
System\Data\Metadata\Edm\Provider\EdmProviderManifest.cs (5)
199Interlocked.CompareExchange<System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType>>(ref _primitiveTypes, readOnlyTypes, null); 340Interlocked.CompareExchange<Dictionary<PrimitiveType, System.Collections.ObjectModel.ReadOnlyCollection<FacetDescription>>>(ref _facetDescriptions, 726Interlocked.CompareExchange<System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction>>(ref _functions, readOnlyFunctions, null); 829Interlocked.CompareExchange<System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType>[]>(ref _promotionTypes, 870Interlocked.CompareExchange<TypeUsage[]>(ref _canonicalModelTypes, canonicalTypes, null);
System\Data\Metadata\Edm\RelationshipType.cs (1)
54Interlocked.CompareExchange(ref _relationshipEndMembers, relationshipEndMembers, null);
System\Data\Metadata\Edm\RowType.cs (1)
93Interlocked.CompareExchange(ref _properties,
System\Data\Metadata\Edm\TypeUsage.cs (3)
386System.Threading.Interlocked.CompareExchange(ref _facets, facets.AsReadOnlyMetadataCollection(), null); 460System.Threading.Interlocked.CompareExchange(ref _modelTypeUsage, result, null); 511System.Threading.Interlocked.CompareExchange(ref _identity, identity, null);
System\Data\Metadata\EdmItemCollection.cs (2)
226Interlocked.CompareExchange(ref _getCanonicalInitializerMetadataMemoizer, new Memoizer<InitializerMetadata, InitializerMetadata>( 438Interlocked.CompareExchange(
System\Data\Metadata\MetadataArtifactLoaderCompositeFile.cs (3)
118Interlocked.CompareExchange(ref _csdlChildren, csdlChildren, null); 123Interlocked.CompareExchange(ref _ssdlChildren, ssdlChildren, null); 128Interlocked.CompareExchange(ref _mslChildren, mslChildren, null);
System\Data\Metadata\MetadataCache.cs (1)
409Interlocked.CompareExchange(ref _artifactLoaderCache, artifactLoaderCacheTemp, _artifactLoaderCache);
System\Data\Metadata\TypeSemantics.cs (1)
1149System.Threading.Interlocked.CompareExchange<objectModel.ReadOnlyCollection<PrimitiveType>[,]>(ref _commonTypeClosure, commonTypeClosure, null);
System\Data\Objects\ELinq\InitializerFacet.cs (1)
42Identity = s_identifierPrefix + Interlocked.Increment(ref s_identifier).ToString(CultureInfo.InvariantCulture);
System.Data.Entity.Design (4)
System\Data\Entity\Design\EntityCodeGenerator.cs (4)
502Interlocked.Exchange(ref _csharpCodeGeneratorTypeV2, type); 513Interlocked.Exchange(ref _csharpCodeGeneratorTypeV3, type); 524Interlocked.Exchange(ref _vbCodeGeneratorTypeV2, type); 535Interlocked.Exchange(ref _vbCodeGeneratorTypeV3, type);
System.Data.Linq (3)
Mapping\MappingSource.cs (3)
37Interlocked.CompareExchange<MetaModel>(ref this.primaryModel, model, null); 50Interlocked.CompareExchange<Dictionary<Type, MetaModel>>(ref this.secondaryModels, new Dictionary<Type, MetaModel>(), null); 55Interlocked.CompareExchange<ReaderWriterLock>(ref this.rwlock, new ReaderWriterLock(), null);
System.Data.Services (2)
parent\Client\System\Data\Services\Client\ReferenceEqualityComparer.cs (1)
134System.Threading.Interlocked.CompareExchange(ref instance, newInstance, null);
System\Data\Services\WebUtil.cs (1)
1000System.Threading.Interlocked.CompareExchange<ResourceType[]>(ref primitiveResourceTypes, types, null);
System.Data.Services.Client (16)
System\Data\Services\Client\BaseAsyncResult.cs (8)
122System.Threading.Interlocked.CompareExchange(ref this.asyncWait, new System.Threading.ManualResetEvent(this.IsCompleted), null); 227if (System.Threading.Interlocked.Exchange(ref result.done, 1) != 0) 235System.Threading.Interlocked.CompareExchange(ref result.asyncWaitDisposeLock, new object(), null); 333if (this.IsCompletedInternally && (System.Threading.Interlocked.Exchange(ref this.userNotified, 1) == 0)) 385System.Threading.Interlocked.CompareExchange(ref this.failure, e, null); 393System.Threading.Interlocked.Exchange(ref this.completed, 2); 399System.Threading.Interlocked.CompareExchange(ref this.completed, 1, 0); 457System.Threading.Interlocked.CompareExchange(ref this.asyncWaitDisposeLock, new object(), null);
System\Data\Services\Client\DataServiceContext.cs (5)
3572System.Threading.Interlocked.CompareExchange(ref this.identityToDescriptor, new Dictionary<String, EntityDescriptor>(EqualityComparer<String>.Default), null); 4501System.Threading.Interlocked.CompareExchange(ref this.request, null, pereq); 4504System.Threading.Interlocked.CompareExchange(ref this.batchResponse, pereq.HttpWebResponse, null); 6199System.Threading.Interlocked.CompareExchange(ref this.requestStatus, 1, 0); 6207System.Threading.Interlocked.Exchange(ref this.requestStatus, 2);
System\Data\Services\Client\QueryResult.cs (1)
427return System.Threading.Interlocked.Exchange(ref reusableAsyncCopyBuffer, null) ?? new byte[8000];
System\Data\Services\Client\ReferenceEqualityComparer.cs (1)
134System.Threading.Interlocked.CompareExchange(ref instance, newInstance, null);
System\Data\Services\Client\Util.cs (1)
255System.Threading.Interlocked.CompareExchange(ref Util.whitespaceForTracing, tmp, whitespace);
System.Data.SqlXml (3)
System\Xml\Xsl\IlGen\XmlILModule.cs (1)
340System.Threading.Interlocked.Increment(ref AssemblyId);
System\Xml\Xsl\Xslt\Scripts.cs (1)
61return "Script" + Interlocked.Increment(ref scriptClassCounter);
System\Xml\Xsl\XsltOld\Compiler.cs (1)
685return "ScriptClass_" + System.Threading.Interlocked.Increment(ref scriptClassCounter);
System.Drawing (3)
commonui\System\Drawing\BufferedGraphicsContext.cs (3)
146int oldBusy = Interlocked.CompareExchange(ref busy, BUFFER_BUSY_PAINTING, BUFFER_FREE); 564int oldBusy = Interlocked.CompareExchange(ref busy, BUFFER_BUSY_DISPOSING, BUFFER_FREE); 628int oldBusy = Interlocked.CompareExchange(ref busy, BUFFER_BUSY_DISPOSING, BUFFER_FREE);
System.IdentityModel (1)
System\IdentityModel\SecurityUniqueId.cs (1)
33return new SecurityUniqueId(prefix, Interlocked.Increment(ref nextId));
System.IdentityModel.Selectors (2)
infocard\client\System\IdentityModel\Selectors\CryptoHandle.cs (2)
243Interlocked.Increment(ref m_refcount); 249int refcount = Interlocked.Decrement(ref m_refcount);
System.Management (2)
Instrumentation\EventSource.cs (1)
177Interlocked.Increment(ref shutdownInProgress);
wmieventsink.cs (1)
121hash = Threading.Interlocked.Increment(ref s_hash);
System.Net (27)
net\PeerToPeer\Collaboration\ContactManager.cs (6)
213Interlocked.CompareExchange(ref m_lockSubLstChangedEvent, o, null); 414Interlocked.CompareExchange(ref m_lockNameChangedEvent, o, null); 621Interlocked.CompareExchange(ref m_lockPresenceChangedEvent, o, null); 833Interlocked.CompareExchange(ref m_lockAppChangedEvent, o, null); 1047Interlocked.CompareExchange(ref m_lockObjChangedEvent, o, null); 1468Interlocked.CompareExchange(ref m_createContactAsyncListLock, o, null);
net\PeerToPeer\Collaboration\Peer.cs (3)
903Interlocked.CompareExchange(ref s_TraceEventId, 0, int.MaxValue); 904Interlocked.Increment(ref s_TraceEventId); 1284Interlocked.Increment(ref m_numberOfResponses);
net\PeerToPeer\Collaboration\PeerApplication.cs (1)
214Interlocked.CompareExchange(ref m_lockAppChangedEvent, o, null);
net\PeerToPeer\Collaboration\PeerCollaboration.cs (5)
186Interlocked.CompareExchange(ref s_contactManagerSyncObject, o, null); 1008Interlocked.CompareExchange(ref s_lockNameChangedEvent, o, null); 1209Interlocked.CompareExchange(ref s_lockPresenceChangedEvent, o, null); 1377Interlocked.CompareExchange(ref s_lockObjChangedEvent, o, null); 1542Interlocked.CompareExchange(ref s_lockAppChangedEvent, o, null);
net\PeerToPeer\Collaboration\PeerContact.cs (5)
186Interlocked.CompareExchange(ref m_isSubscribeLock, o, null); 520Interlocked.CompareExchange(ref m_asyncOpLock, o, null); 1183Interlocked.CompareExchange(ref m_lockAppChangedEvent, o, null); 1435Interlocked.CompareExchange(ref m_lockObjChangedEvent, o, null); 1689Interlocked.CompareExchange(ref m_lockPresenceChangedEvent, o, null);
net\PeerToPeer\Collaboration\PeerEndPoint.cs (1)
186Interlocked.CompareExchange(ref m_lockNameChangedEvent, o, null);
net\PeerToPeer\Collaboration\PeerNearMe.cs (2)
416Interlocked.CompareExchange(ref m_refreshDataAsyncOpLock, o, null); 525Interlocked.CompareExchange(ref s_lockPNMChangedEvent, o, null);
net\PeerToPeer\Collaboration\PeerObject.cs (1)
167Interlocked.CompareExchange(ref m_lockObjChangedEvent, o, null);
net\PeerToPeer\PeerNameResolver.cs (2)
912Interlocked.CompareExchange(ref s_TraceEventId, 0, int.MaxValue); 913Interlocked.Increment(ref s_TraceEventId);
net\PeerToPeer\UnsafePeerToPeerMethods.cs (1)
146Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
System.Runtime.Caching (25)
System\Caching\CacheMemoryMonitor.cs (4)
108Interlocked.Exchange(ref s_autoPrivateBytesLimit, memoryLimit); 117if (sref != null && Interlocked.CompareExchange(ref _sizedRefMultiple, null, sref) == sref) { 131Interlocked.Exchange(ref s_effectiveProcessMemoryLimit, memoryLimit); 255Interlocked.CompareExchange(ref s_memoryCacheManager, memoryCacheManager, null);
System\Caching\ChangeMonitor.cs (2)
109Interlocked.CompareExchange(ref _onChangedState, state, NOT_SET); 215if (Interlocked.CompareExchange(ref _onChangedCallback, onChangedCallback, null) != null) {
System\Caching\HostFileChangeMonitor.cs (1)
90Interlocked.CompareExchange(ref s_fcn, fcn, null);
System\Caching\MemoryCache.cs (1)
390if (Interlocked.Exchange(ref _disposed, 1) == 0) {
System\Caching\MemoryCacheEntry.cs (1)
174return (Interlocked.CompareExchange(ref _state, (int)value, (int)comparand) == (int)comparand);
System\Caching\MemoryCacheStatistics.cs (6)
205if (Interlocked.Exchange(ref _inCacheManagerThread, 1) != 0) 249Interlocked.Exchange(ref _inCacheManagerThread, 0); 254if (Interlocked.Exchange(ref _disposed, 1) == 0) { 257if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef) { 294while (Interlocked.Exchange(ref _inCacheManagerThread, 1) != 0) { 310Interlocked.Exchange(ref _inCacheManagerThread, 0);
System\Caching\MemoryCacheStore.cs (1)
212if (Interlocked.Exchange(ref _disposed, 1) == 0) {
System\Caching\ObjectCache.cs (1)
33if (Interlocked.CompareExchange(ref _host, value, null) != null) {
System\Caching\PerfCounters.cs (6)
54Interlocked.CompareExchange(ref s_appId, appId, null); 114Interlocked.Decrement(ref _counterValues[idx]); 121Interlocked.Increment(ref _counterValues[idx]); 128Interlocked.Add(ref _counterValues[idx], value); 134if (counters != null && Interlocked.CompareExchange(ref _counters, null, counters) == counters) { 139long value = Interlocked.Exchange(ref _counterValues[i], 0);
System\Caching\SafeBitVector32.cs (2)
32int result = Interlocked.CompareExchange(ref _data, newData, oldData); 58int result = Interlocked.CompareExchange(ref _data, newData, oldData);
System.Runtime.DurableInstancing (7)
System\Runtime\DurableInstancing\InstancePersistenceContext.cs (2)
125if (Interlocked.CompareExchange(ref this.cancellationHandlerCalled, 0, 1) == 0) 789if (Interlocked.CompareExchange(ref this.cancellationHandlerCalled, 0, 1) == 0)
System\Runtime\DurableInstancing\InstancePersistenceEvent.cs (1)
76Interlocked.CompareExchange<T>(ref instance, new T(), null);
System\Runtime\DurableInstancing\InstanceView.cs (3)
279if (Interlocked.CompareExchange(ref this.instanceVersion, instanceVersion, -1) != -1) 299if (Interlocked.CompareExchange(ref this.instanceVersion, checked(-instanceVersion - 2), -1) != -1) 312long result = Interlocked.CompareExchange(ref this.instanceVersion, instanceVersion, -instanceVersion - 2);
System\Runtime\PersistencePipeline.cs (1)
535return Interlocked.Decrement(ref this.remainingModules) == 0;
System.Runtime.Remoting (8)
channels\core\bytebufferpool.cs (2)
85cookie = Interlocked.Exchange(ref _controlCookie, null); 165cookie = Interlocked.Exchange(ref _controlCookie, null);
channels\core\requestqueue.cs (2)
147Interlocked.Increment(ref _workItemCount); 153Interlocked.Decrement(ref _workItemCount);
channels\core\socketmanager.cs (2)
88if (1 == Interlocked.Exchange(ref _controlCookie, 0)) 194byte[] bufferToReturn = Interlocked.Exchange(ref _dataBuffer, null);
channels\http\httpstreams.cs (1)
511_connectionId = Interlocked.Increment(ref _connectionIdCounter);
channels\tcp\tcpstreams.cs (1)
251_connectionId = Interlocked.Increment(ref _connectionIdCounter);
System.Runtime.Serialization (4)
System\Xml\XmlMtomWriter.cs (1)
883long nextId = Interlocked.Increment(ref id);
System\Xml\XmlStreamNodeWriter.cs (3)
167if (Interlocked.CompareExchange(ref this.hasPendingWrite, 1, 0) != 0) 189if (Interlocked.CompareExchange(ref this.hasPendingWrite, 0, 1) != 1) 210if (Interlocked.CompareExchange(ref thisPtr.hasPendingWrite, 0, 1) != 1)
System.ServiceModel (84)
System\ServiceModel\Channels\BufferedOutputAsyncStream.cs (2)
161if (Interlocked.Increment(ref this.asyncWriteCount) > 1) 169if (Interlocked.Decrement(ref this.asyncWriteCount) != 0)
System\ServiceModel\Channels\ChannelDemuxer.cs (1)
3132return Interlocked.Exchange<TItem>(ref this.firstItem, null);
System\ServiceModel\Channels\CloseCollectionAsyncResult.cs (1)
96if (Interlocked.Decrement(ref count) == 0)
System\ServiceModel\Channels\HttpChannelFactory.cs (3)
191this.uniqueConnectionGroupNamePrefix = Interlocked.Increment(ref connectionGroupNamePrefix).ToString(); 1375if (Interlocked.CompareExchange(ref this.webRequestCompleted, 1, 0) == 0) 1913if (Interlocked.CompareExchange(ref this.webRequestCompleted, 1, 0) == 0)
System\ServiceModel\Channels\HttpChannelHelpers.cs (1)
1179byte[] bufferToRecycleSnapshot = Interlocked.Exchange<byte[]>(ref this.bufferToRecycle, null);
System\ServiceModel\Channels\HttpPipeline.cs (1)
128if (Interlocked.Exchange(ref this.isClosed, 1) == 0)
System\ServiceModel\Channels\HttpRequestContext.cs (1)
812byte[] buffer = Interlocked.CompareExchange<byte[]>(ref this.webSocketInternalBuffer, null, this.webSocketInternalBuffer);
System\ServiceModel\Channels\InternalDuplexChannelFactory.cs (1)
34long tempChannelCount = Interlocked.Increment(ref channelCount);
System\ServiceModel\Channels\LifetimeManager.cs (6)
132Interlocked.Increment(ref busyWaiterCount); 139if (Interlocked.Decrement(ref busyWaiterCount) == 0) 165Interlocked.Increment(ref this.busyWaiterCount); 174if (Interlocked.Decrement(ref this.busyWaiterCount) == 0) 230Interlocked.Increment(ref this.busyWaiterCount); 265if (Interlocked.Decrement(ref this.busyWaiterCount) == 0)
System\ServiceModel\Channels\MsmqInputSessionChannel.cs (4)
86Interlocked.Increment(ref uncommittedMessageCount); 87Interlocked.Decrement(ref incompleteMessageCount); 130Interlocked.Increment(ref incompleteMessageCount); 165Interlocked.Increment(ref incompleteMessageCount);
System\ServiceModel\Channels\OpenCollectionAsyncResult.cs (1)
71if (Interlocked.Decrement(ref count) == 0)
System\ServiceModel\Channels\PeerFlooder.cs (3)
253long temp = Interlocked.Increment(ref messageSequence); 543Interlocked.Decrement(ref outgoingEnqueuedCount); 548int value = Interlocked.Increment(ref outgoingEnqueuedCount);
System\ServiceModel\Channels\PeerHelpers.cs (2)
35int value = Interlocked.Increment(ref enqueuedCount); 44int value = Interlocked.Decrement(ref enqueuedCount);
System\ServiceModel\Channels\ServiceChannel.cs (5)
881int updatedActivityCount = Interlocked.Decrement(ref this.activityCount); 1222Interlocked.Increment(ref this.activityCount); 2493if (Interlocked.Increment(ref this.waitCount) == 2) 2625Interlocked.Exchange(ref this.lastActivity, Ticks.Now); 2655long last = Interlocked.CompareExchange(ref this.lastActivity, 0, 0);
System\ServiceModel\Channels\SharedTcpTransportManager.cs (1)
160SharedConnectionListener currentListener = Interlocked.Exchange<SharedConnectionListener>(ref this.listener, null);
System\ServiceModel\Channels\UriGenerator.cs (1)
38long nextId = Interlocked.Increment(ref id);
System\ServiceModel\Channels\UtilityExtension.cs (2)
123Interlocked.Increment(ref pendingSends); 138Interlocked.Decrement(ref pendingSends);
System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (7)
378if (Interlocked.CompareExchange(ref this.cleanupStatus, WebSocketHelper.OperationFinished, WebSocketHelper.OperationNotStarted) == WebSocketHelper.OperationNotStarted) 563if (Interlocked.CompareExchange(ref this.asyncReceiveState, AsyncReceiveState.Cancelled, AsyncReceiveState.Started) == AsyncReceiveState.Started) 836int currentState = Interlocked.CompareExchange(ref this.asyncReceiveState, AsyncReceiveState.Started, AsyncReceiveState.Finished); 921if (Interlocked.CompareExchange(ref this.asyncReceiveState, AsyncReceiveState.Finished, AsyncReceiveState.Started) == AsyncReceiveState.Started) 1379if (Interlocked.CompareExchange(ref this.endOfMessageWritten, WebSocketHelper.OperationFinished, WebSocketHelper.OperationNotStarted) == WebSocketHelper.OperationNotStarted) 1457if (Interlocked.CompareExchange(ref this.messageSourceCleanState, WebSocketHelper.OperationFinished, WebSocketHelper.OperationNotStarted) == WebSocketHelper.OperationNotStarted) 1495if (Interlocked.CompareExchange(ref this.endOfMessageWritten, WebSocketHelper.OperationFinished, WebSocketHelper.OperationNotStarted) == WebSocketHelper.OperationNotStarted)
System\ServiceModel\ComIntegration\TypeLibraryHelper.cs (2)
49Interlocked.Increment(ref instanceCount); 55if (0 == Interlocked.Decrement(ref instanceCount))
System\ServiceModel\Diagnostics\PerformanceCountersBase.cs (1)
106if (Interlocked.Exchange(ref disposed, 1) == 0)
System\ServiceModel\Diagnostics\ServiceModelActivity.cs (1)
349newStopCount = Interlocked.Increment(ref this.stopCount);
System\ServiceModel\Diagnostics\TraceUtility.cs (1)
927return Interlocked.Increment(ref TraceUtility.messageNumber);
System\ServiceModel\Dispatcher\BufferedReceiveBinder.cs (4)
74if (Interlocked.CompareExchange(ref this.pendingOperationSemaphore, 1, 0) == 0) 96if (Interlocked.CompareExchange(ref this.pendingOperationSemaphore, 1, 0) == 0) 208Interlocked.Exchange(ref binder.pendingOperationSemaphore, 0); 250Interlocked.Exchange(ref binder.pendingOperationSemaphore, 0);
System\ServiceModel\Dispatcher\ChannelHandler.cs (2)
1449Interlocked.Exchange(ref this.isPumpAcquired, 0); 2005return Interlocked.CompareExchange(ref this.isPumpAcquired, 1, 0) == 0;
System\ServiceModel\Dispatcher\InstanceContextManager.cs (1)
350if (Interlocked.Decrement(ref count) == 0)
System\ServiceModel\Dispatcher\MultipleReceiveBinder.cs (1)
378if (slot == (slot = Interlocked.CompareExchange(ref this.pending, (slot + 1) % this.size, slot)))
System\ServiceModel\Dispatcher\QueryNode.cs (2)
1195Interlocked.Increment(ref this.seq.refCount); 1206if (Interlocked.CompareExchange(ref this.disposed, 1, 0) == 0)
System\ServiceModel\Dispatcher\QueryProcessor.cs (2)
717Interlocked.Increment(ref this.refCount); 965return (Interlocked.Decrement(ref this.refCount) == 0);
System\ServiceModel\InstanceContext.cs (1)
609object oldUserObject = Interlocked.Exchange(ref this.userObject, newUserObject);
System\ServiceModel\PeerResolvers\PeerDefaultCustomResolverClient.cs (4)
176int oldValue = Interlocked.Exchange(ref this.updateSuccessful, 1); 272Interlocked.Exchange(ref this.updateSuccessful, 1); 283Interlocked.Exchange(ref this.updateSuccessful, 0); 289Interlocked.Exchange(ref this.updateSuccessful, 0);
System\ServiceModel\Security\SecurityListenerSettingsLifetimeManager.cs (4)
34if (Interlocked.Decrement(ref this.referenceCount) == 0) 42Interlocked.Increment(ref this.referenceCount); 121if (Interlocked.Decrement(ref this.referenceCount) == 0) 150if (Interlocked.Decrement(ref this.referenceCount) == 0)
System\ServiceModel\Security\SecurityUtils.cs (1)
2413return new SecurityUniqueId(prefix, Interlocked.Increment(ref nextId));
System\ServiceModel\ServiceChannelManager.cs (8)
140Interlocked.Increment(ref this.activityWaiterCount); 177Interlocked.Increment(ref this.activityWaiterCount); 184if (Interlocked.Decrement(ref this.activityWaiterCount) == 0) 216Interlocked.Increment(ref this.activityWaiterCount); 226if (Interlocked.Decrement(ref this.activityWaiterCount) == 0) 242if (Interlocked.Decrement(ref this.activityWaiterCount) == 0) 297Interlocked.Increment(ref this.activityWaiterCount); 304if (Interlocked.Decrement(ref this.activityWaiterCount) == 0)
System\ServiceModel\ServiceHost.cs (2)
1205Interlocked.Increment(ref this.busyCount); 1229Interlocked.Decrement(ref this.busyCount);
System\ServiceModel\Transactions\WsatProxy.cs (1)
379Interlocked.CompareExchange<byte[]>(ref fixedPropagationToken, token, null);
System\UriTemplate.cs (3)
268Interlocked.CompareExchange<IDictionary<string, string>>(ref this.defaults, new UriTemplateDefaults(this), null); 1180Interlocked.CompareExchange<ReadOnlyCollection<string>>(ref this.pathSegmentVariableNamesSnapshot, new ReadOnlyCollection<string>( 1192Interlocked.CompareExchange<ReadOnlyCollection<string>>(ref this.queryValueVariableNamesSnapshot, new ReadOnlyCollection<string>(
System.ServiceModel.Activation (22)
System\ServiceModel\Activation\CollectibleLRUCache.cs (4)
80node.LastCounter = Interlocked.Increment(ref counter); 115node.LastCounter = Interlocked.Increment(ref counter); 139node.LastCounter = Interlocked.Increment(ref counter); 353int currentCount = Interlocked.Decrement(ref this.totalCollectCount);
System\ServiceModel\Activation\HostedAspNetEnvironment.cs (4)
647Interlocked.Increment(ref busyCount); 717Interlocked.Increment(ref this.ambientTransactionCount); 723if (Interlocked.Exchange(ref this.ambientTransactionCount, 0) != 1) 732if (Interlocked.Exchange(ref this.busyCount, 0) == 1)
System\ServiceModel\Activation\HostedHttpContext.cs (1)
181if (Interlocked.Increment(ref this.impersonationReleased) == 1)
System\ServiceModel\Activation\HostedHttpRequestAsyncResult.cs (7)
618Interlocked.CompareExchange(ref this.state, State.Completed, State.Running) == State.Running) 627Interlocked.CompareExchange(ref this.state, State.Aborted, State.Running) == State.Running) 629int currentStreamedReadState = Interlocked.Exchange(ref this.streamedReadState, StreamedReadState.AbortStarted); 647if (Interlocked.CompareExchange(ref this.streamedReadState, StreamedReadState.Aborted, StreamedReadState.AbortStarted) == StreamedReadState.AbortStarted) 666return Interlocked.CompareExchange(ref this.streamedReadState, StreamedReadState.ReceiveStarted, StreamedReadState.None) == StreamedReadState.None; 671if (Interlocked.CompareExchange(ref this.streamedReadState, StreamedReadState.None, StreamedReadState.ReceiveStarted) == StreamedReadState.ReceiveStarted) 676if (Interlocked.CompareExchange(ref this.streamedReadState, StreamedReadState.ReceiveFinishedAfterAbortStarted, StreamedReadState.AbortStarted) == StreamedReadState.AbortStarted)
System\ServiceModel\Activation\HostedImpersonationContext.cs (3)
44Interlocked.Increment(ref refCount); 107Interlocked.Increment(ref refCount); 118int currentCount = Interlocked.Decrement(ref refCount);
System\ServiceModel\Activation\MetabaseReader.cs (1)
227int handleToClose = Interlocked.Exchange(ref mdHandle, 0);
System\ServiceModel\ServiceHostingEnvironment.cs (2)
280Interlocked.Increment(ref requestCount); 297Interlocked.Decrement(ref requestCount);
System.ServiceModel.Activities (4)
System\ServiceModel\Activities\Dispatcher\BufferedReceiveManager.cs (1)
326if (Interlocked.CompareExchange(ref this.initialized, 1, 0) != 0)
System\ServiceModel\Activities\Dispatcher\DurableInstanceManager.cs (2)
803if (Interlocked.Increment(ref this.completedUnloadCount) == this.instanceCount) 884if (Interlocked.Increment(ref thisPtr.completedUnloadCount) == thisPtr.instanceCount)
System\ServiceModel\Activities\WorkflowControlEndpoint.cs (1)
120Interlocked.CompareExchange(ref defaultBaseUri, tempUri, null);
System.ServiceModel.Channels (2)
System\ServiceModel\Channels\UdpChannelListener.cs (1)
394if (Interlocked.Increment(ref this.cleanedUp) == 1)
System\ServiceModel\Channels\XmlByteStreamWriter.cs (1)
46Interlocked.CompareExchange<XmlWriterSettings>(ref this.settings, newSettings, null);
System.ServiceModel.Discovery (13)
System\ServiceModel\Discovery\AnnouncementDispatcherAsyncResult.cs (4)
96complete = (Interlocked.Increment(ref this.completions) == innerResults.Length); 146if (Interlocked.Increment(ref this.completions) == innerResults.Length) 183if (Threading.Interlocked.Increment(ref this.completesCounter) == 1) 191if (Threading.Interlocked.Increment(ref this.completesCounter) == 1)
System\ServiceModel\Discovery\DiscoveryClient.cs (1)
924return ((Interlocked.CompareExchange(ref this.closeCalled, 1, 0) == 1) || this.asyncOperationsLifetimeManager.IsAborted);
System\ServiceModel\Discovery\DiscoveryMessageSequenceGenerator.cs (1)
44return new DiscoveryMessageSequence(this.instanceId, this.sequenceId, Threading.Interlocked.Increment(ref this.messageNumber));
System\ServiceModel\Discovery\IteratorAsyncResult.cs (1)
78if (Interlocked.CompareExchange(ref this.completedCalled, 1, 0) == 0)
System\ServiceModel\Discovery\RandomDelaySendsAsyncResult.cs (6)
111if (Threading.Interlocked.Increment(ref this.sendCompletesCounter) == this.numSends) 157if (Threading.Interlocked.Increment(ref this.sendCompletesCounter) == this.numSends) 167int index = Threading.Interlocked.Increment(ref this.currentSendIndex); 195if (Threading.Interlocked.Increment(ref this.sendCompletesCounter) == this.numSends) 268if (Threading.Interlocked.Increment(ref this.completesCounter) == 1) 280if (Threading.Interlocked.Increment(ref this.completesCounter) == 1)
System.ServiceModel.Internals (27)
System\Runtime\Collections\HopperCache.cs (1)
170wasPromoting = Interlocked.CompareExchange(ref this.promoting, 1, 0);
System\Runtime\Diagnostics\DiagnosticEventProvider.cs (1)
103if ((this.isDisposed != 1) && (Interlocked.Exchange(ref this.isDisposed, 1) == 0))
System\Runtime\IOThreadScheduler.cs (22)
152int slot = Interlocked.Add(ref this.headTail, Bits.HiOne); 159slot = Interlocked.Add(ref this.headTail, Bits.HiOne); 180Interlocked.CompareExchange<IOThreadScheduler>(ref IOThreadScheduler.current, next, this); 198int slot = Interlocked.Add(ref this.headTailLowPri, Bits.HiOne); 213int interlockedResult = Interlocked.CompareExchange(ref this.headTail, ht + Bits.HiOne, ht); 238Interlocked.CompareExchange<IOThreadScheduler>(ref IOThreadScheduler.current, next, this); 269if (slotLowPri == (slotLowPri = Interlocked.CompareExchange(ref this.headTailLowPri, 279if (slot == (slot = Interlocked.CompareExchange(ref this.headTail, Bits.IncrementLo(slot), slot))) 303if (slot == Interlocked.CompareExchange(ref this.headTail, slot + Bits.HiOne, slot)) 333if (slot == (slot = Interlocked.CompareExchange(ref this.headTail, Bits.IncrementLo(slot), slot))) 344if (slotLowPri == (slotLowPri = Interlocked.CompareExchange(ref this.headTailLowPri, 482int gateSnapshot = Interlocked.Increment(ref this.gate); 488Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot); 500gateSnapshot = Interlocked.Add(ref this.gate, Bits.LoHiBit); 515Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot) != gateSnapshot) 517gateSnapshot = Interlocked.Add(ref this.gate, Bits.HiHiBit); 520Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot); 531int gateSnapshot = Interlocked.Add(ref this.gate, Bits.HiOne); 555Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot) != gateSnapshot) 557gateSnapshot = Interlocked.Add(ref this.gate, Bits.HiHiBit); 560Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot); 572Interlocked.CompareExchange(ref this.gate, 0, gateSnapshot);
System\Runtime\NameGenerator.cs (1)
25long nextId = Interlocked.Increment(ref nameGenerator.id);
System\Runtime\SignalGate.cs (2)
44lastState = Interlocked.CompareExchange(ref this.state, GateState.SignalPending, GateState.Locked); 68lastState = Interlocked.CompareExchange(ref this.state, GateState.Unlocked, GateState.Locked);
System.Transactions (35)
System\Transactions\CommittableTransaction.cs (2)
174if (Interlocked.Exchange(ref this.disposed, Transaction.disposedTrueValue) == Transaction.disposedTrueValue) 189long remainingITx = Interlocked.Decrement(ref this.internalTransaction.cloneCount);
System\Transactions\DurableEnlistmentState.cs (1)
142Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\Enlistment.cs (1)
296Convert.ToString(Interlocked.Increment(ref InternalTransaction.nextHash), CultureInfo.InvariantCulture),
System\Transactions\EnlistmentState.cs (1)
37Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\InternalTransaction.cs (1)
207Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\Oletx\OletxDependentTransaction.cs (1)
53int localCompleted = Interlocked.CompareExchange( ref this.completed, 1, 0 );
System\Transactions\Oletx\OletxEnlistment.cs (2)
1165Interlocked.CompareExchange<Exception>( ref this.oletxTransaction.realOletxTransaction.innerException, e, null ); 1321Interlocked.CompareExchange<Exception>( ref this.oletxTransaction.realOletxTransaction.innerException, e, null );
System\Transactions\Oletx\OleTxTransaction.cs (6)
231int localDisposed = Interlocked.CompareExchange( ref this.disposed, 1, 0 ); 695Interlocked.Increment(ref this.undecidedEnlistmentCount); 707Interlocked.Decrement(ref this.undecidedEnlistmentCount); 1231Interlocked.CompareExchange<Exception>( ref this.innerException, comException, null ); 1351Interlocked.Increment( ref this.undisposedOletxTransactionCount ); 1356int localCount = Interlocked.Decrement( ref this.undisposedOletxTransactionCount );
System\Transactions\Oletx\OletxTransactionManager.cs (1)
964Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\Oletx\OletxVolatileEnlistment.cs (1)
1673Interlocked.CompareExchange<Exception>( ref this.oletxTransaction.realOletxTransaction.innerException, e, null );
System\Transactions\Transaction.cs (4)
442this.cloneId = Interlocked.Increment(ref this.internalTransaction.cloneCount); 459this.cloneId = Interlocked.Increment(ref this.internalTransaction.cloneCount); 1149if (Interlocked.Exchange(ref this.disposed, Transaction.disposedTrueValue) == Transaction.disposedTrueValue) 1155long remainingITx = Interlocked.Decrement(ref this.internalTransaction.cloneCount);
System\Transactions\TransactionManager.cs (1)
349Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\TransactionState.cs (1)
759Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\TransactionTable.cs (10)
40Interlocked.CompareExchange( ref this.syncRoot, new object(), null ); 62Interlocked.CompareExchange( ref this.writerFinishedEvent, new ManualResetEvent( true ), null ); 79readerIndex = Interlocked.Increment( ref this.readersIn ); 86Interlocked.Decrement( ref this.readersIn ); 124Interlocked.Increment( ref this.readersOut ); 327WeakReference oldNextSetWeak = (WeakReference)Interlocked.CompareExchange( 355WeakReference oldNextSetWeak = (WeakReference)Interlocked.CompareExchange( 527(WeakReference)Interlocked.CompareExchange( ref lastBucketSet.nextSetWeak, null, nextWeakSet ); 650int currentIndex = Interlocked.Increment( ref this.index ); 672Bucket oldBucket = Interlocked.CompareExchange( ref this.owningSet.headBucket, newBucket, this );
System\Transactions\VolatileEnlistmentMultiplexing.cs (1)
80Interlocked.CompareExchange( ref classSyncObject, o, null );
System\Transactions\VolatileEnlistmentState.cs (1)
253Interlocked.CompareExchange( ref classSyncObject, o, null );
System.Web (148)
AspNetSynchronizationContext.cs (2)
104Interlocked.Decrement(ref _state.VoidAsyncOutstandingOperationCount); // this line goes first since ChangeOperationCount might invoke a callback which depends on this value 117Interlocked.Increment(ref _state.VoidAsyncOutstandingOperationCount);
Cache\OutputCache.cs (2)
128Interlocked.Decrement(ref s_cEntries); 133Interlocked.Increment(ref s_cEntries);
Cache\SqlCacheDependency.cs (7)
783if (Interlocked.CompareExchange(ref dbState._rqInCallback, 1, 0) != 0) { 803if (Interlocked.CompareExchange(ref dbState._rqInCallback, 1, 0) == 0) { 837Interlocked.Increment(ref s_activePolling); 982Interlocked.Decrement(ref s_activePolling); 985Interlocked.Exchange(ref dbState._rqInCallback, 0); 1166Interlocked.Increment(ref dbState._refCount); 1178Interlocked.Decrement(ref dbState._refCount);
Compilation\BuildManagerHost.cs (2)
150Interlocked.Increment(ref _pendingCallsCount); 154Interlocked.Decrement(ref _pendingCallsCount);
Compilation\BuildResult.cs (3)
353if (Interlocked.CompareExchange(ref _lock, 1, 0) != 0) { 365Interlocked.Exchange(ref _lock, 0); 382Interlocked.Exchange(ref _lock, 0);
Compilation\BuildResultCache.cs (1)
603if (s_shutdownStatus == SHUTDOWN_NEEDED && (Interlocked.Exchange(ref s_shutdownStatus, SHUTDOWN_STARTED) == SHUTDOWN_NEEDED)) {
Compilation\CompilationLock.cs (3)
113if (Interlocked.CompareExchange(ref _lockStatus, lockStatus+1, lockStatus) == lockStatus) 121Interlocked.Decrement(ref _lockStatus); 148Interlocked.Decrement(ref _lockStatus);
Compilation\CompilationUtil.cs (1)
663Interlocked.CompareExchange(ref _maxConcurrentCompilations, maxConcurrentCompilations, 0);
Configuration\HttpCapabilitiesEvaluator.cs (1)
111int id = Interlocked.Increment(ref _idCounter);
Configuration\NativeConfig.cs (1)
48IntPtr pConfigSystem = Interlocked.Exchange(ref _nativeConfig, IntPtr.Zero);
Configuration\serverconfig.cs (2)
89Interlocked.CompareExchange(ref s_iisMajorVersion, version, 0); 148Interlocked.CompareExchange(ref s_useServerConfig, useServerConfig, -1);
FileChangesMonitor.cs (12)
453Interlocked.Increment(ref _activeDirMonCompletions); 474if (Interlocked.Exchange(ref _disposed, 1) == 0) { 517Interlocked.Decrement(ref _activeDirMonCompletions); 1013if (Interlocked.Increment(ref s_notificationBufferSizeIncreased) == 1) { 1289if (s_notificationQueue.Count > 0 && s_inNotificationThread == 0 && Interlocked.Exchange(ref s_inNotificationThread, 1) == 0) { 1341Interlocked.Exchange(ref s_inNotificationThread, 0); 1345if (s_notificationQueue.Count == 0 || Interlocked.Exchange(ref s_inNotificationThread, 1) != 0) 1350Interlocked.Exchange(ref s_inNotificationThread, 0); 2042Interlocked.Increment(ref _activeCallbackCount); 2061Interlocked.Decrement(ref _activeCallbackCount); 2067Interlocked.Increment(ref _activeCallbackCount); 2081Interlocked.Decrement(ref _activeCallbackCount);
Hosting\ApplicationManager.cs (9)
130object originalValue = Interlocked.CompareExchange(ref _fatalException, e, null); 194Interlocked.Increment(ref _openCount); 200if (Interlocked.Decrement(ref _openCount) > 0) 693if (Interlocked.CompareExchange(ref _pendingPingCallback, callback, null) == null) { 710if (Interlocked.CompareExchange(ref _pendingPingCallback, null, callback) == callback) { 729int count = Interlocked.Increment(ref _activeHostingEnvCount); 743Interlocked.Decrement(ref _activeHostingEnvCount); 756Interlocked.Decrement(ref _accessibleHostingEnvCount); 862Interlocked.Increment(ref _accessibleHostingEnvCount);
Hosting\AsyncResultBase.cs (2)
65Thread originalThread = Interlocked.CompareExchange(ref _threadWhichStartedOperation, Thread.CurrentThread, null); 70Thread originalThread = Interlocked.Exchange(ref _threadWhichStartedOperation, null);
Hosting\HostingEnvironment.cs (5)
207if (Interlocked.Exchange(ref _inTrimCache, 1) != 0) 228Interlocked.Exchange(ref _inTrimCache, 0); 829Interlocked.Increment(ref _busyCount); 834Interlocked.Decrement(ref _busyCount); 1194scheduler = Interlocked.CompareExchange(ref _backgroundWorkScheduler, newlyCreatedScheduler, null) ?? newlyCreatedScheduler;
Hosting\IIS7WorkerRequest.cs (3)
537if (Interlocked.CompareExchange(ref _asyncResultBase, ar, null) != null) 615if (Interlocked.CompareExchange(ref _asyncResultBase, ar, null) != null) 2638Interlocked.CompareExchange(ref s_DefaultAllocator, alloc, null);
Hosting\IPipelineRuntime.cs (3)
623Interlocked.Increment(ref _inIndicateCompletionCount); 629Interlocked.Decrement(ref _inIndicateCompletionCount); 725if (Interlocked.Exchange(ref s_isThisAppDomainRemovedFromUnmanagedTable, 1) != 0) {
Hosting\ISAPIRuntime.cs (1)
233if (Interlocked.Exchange(ref _isThisAppDomainRemovedFromUnmanagedTable, 1) != 0) {
Hosting\ISAPIWorkerRequest.cs (8)
859if (Interlocked.Decrement(ref _cachedResponseBodyBytesIoLockCount) == 0) { 976if (Interlocked.Decrement(ref _endOfRequestCallbackLockCount) == 0) { 2362Interlocked.Increment(ref _asyncIoCount); // increment async io count 2379Interlocked.Increment(ref _asyncIoCount); // increment async io count 2423Interlocked.Decrement(ref _asyncIoCount); 2479Interlocked.Decrement(ref _asyncIoCount); 2534if (Interlocked.CompareExchange(ref _asyncResultBase, ar, null) != null) 2616if (Interlocked.CompareExchange(ref _asyncResultBase, ar, null) != null)
HttpApplication.cs (3)
334Interlocked.CompareExchange(ref _allocator, alloc, null); 4391int originalState = Interlocked.Exchange(ref _asyncState, ASYNC_STATE_CALLBACK_COMPLETED); 4405int originalState = Interlocked.Exchange(ref _asyncState, ASYNC_STATE_BEGIN_UNWOUND);
HttpAsyncResult.cs (2)
111Thread originalThread = Interlocked.CompareExchange(ref _threadWhichStartedOperation, Thread.CurrentThread, null); 116Thread originalThread = Interlocked.Exchange(ref _threadWhichStartedOperation, null);
HttpContext.cs (5)
1651Interlocked.Exchange(ref _timeoutTicks, value.Ticks); 1710long originalTicks = Interlocked.CompareExchange(ref _timeoutTicks, ticks, -1); 1758Interlocked.Exchange(ref _timeoutStartTimeUtcTicks, DateTime.UtcNow.Ticks); 1762Interlocked.CompareExchange(ref _timeoutState, 0, 1); 1799if (Interlocked.CompareExchange(ref _timeoutState, -1, 1) == 1) {
HttpRuntime.cs (8)
356if (timer != null && Interlocked.CompareExchange(ref _appDomainShutdownTimer, null, timer) == timer) { 1375Interlocked.Increment(ref _theRuntime._activeRequestCount); 1381Interlocked.Decrement(ref _theRuntime._activeRequestCount); 1620Interlocked.Increment(ref _activeRequestCount); 1636Interlocked.Decrement(ref _activeRequestCount); 1659Interlocked.Decrement(ref _activeRequestCount); 1717Interlocked.Increment(ref _activeRequestCount); 1835Interlocked.Decrement(ref _activeRequestCount);
HttpWriter.cs (3)
210IntPtr data = Interlocked.Exchange(ref _data, IntPtr.Zero); 238IntPtr data = Interlocked.Exchange(ref _data, IntPtr.Zero); 961Interlocked.CompareExchange(ref s_DefaultAllocator, alloc, null);
LegacyAspNetSynchronizationContext.cs (2)
153Interlocked.Increment(ref _pendingCount); 166int pendingCount = Interlocked.Decrement(ref _pendingCount);
Management\AppDomainResourcePerfCounters.cs (2)
91Interlocked.Exchange(ref _inProgressLock, 1) != 0) // Is some thread currently executing the callback 100Interlocked.Exchange(ref _inProgressLock, 0);
Management\SimpleMailWebEventProvider.cs (1)
199Interlocked.Increment(ref _nonBufferNotificationSequence), // notificationSequence
Management\SqlWebEventProvider.cs (2)
199Interlocked.Increment(ref _connectionCount); 227Interlocked.Decrement(ref _connectionCount);
Management\TemplatedMailWebEventProvider.cs (1)
157Interlocked.Increment(ref _nonBufferNotificationSequence), // notificationSequence
Management\webeventbuffer.cs (3)
506Interlocked.Increment(ref _threadsInFlush); 523Interlocked.Increment(ref _notificationSequence), 550Interlocked.Decrement(ref _threadsInFlush);
Management\WebEvents.cs (7)
100if (Interlocked.CompareExchange( ref _exceptionLogged, 1, 0) == 0) { 445_sequenceNumber = Interlocked.Increment(ref s_globalSequenceNumber); 448_occurrenceNumber = Interlocked.Increment(ref s_eventCodeOccurrence[index0, index1]); 467_occurrenceNumber = Interlocked.Increment(ref ceco._occurrence); 2222if (Interlocked.CompareExchange(ref _updatingLastFired, 1, 0) == 0) { 2227Interlocked.Exchange(ref _updatingLastFired, 0); 2242timesRaised = Interlocked.Increment(ref _timesRaised);
RequestQueue.cs (2)
215Interlocked.Increment(ref _workItemCount); 226Interlocked.Decrement(ref _workItemCount);
RequestTimeoutManager.cs (6)
74if (Interlocked.CompareExchange(ref _inProgressLock, 1, 0) != 0) 102Interlocked.Exchange(ref _inProgressLock, 0); 124Interlocked.Increment(ref _requestCount); 137Interlocked.Decrement(ref _requestCount); 182Interlocked.Increment( ref _count ); 186return Interlocked.Decrement( ref _count );
State\InProcStateClientManager.cs (1)
136if (initialFlags == Interlocked.CompareExchange(
State\SessionStateModule.cs (2)
1187if (Interlocked.CompareExchange(ref _rqInCallback, 1, 0) != 0) 1221Interlocked.Exchange(ref _rqInCallback, 0);
State\sqlstateclientmanager.cs (2)
826Interlocked.CompareExchange(ref s_isClearPoolInProgress, 0, 1); 849if (0 == Interlocked.CompareExchange(ref s_isClearPoolInProgress, 1, 0)) {
State\StateRuntime.cs (1)
448if (initialFlags == Interlocked.CompareExchange(
UI\LegacyPageAsyncTask.cs (1)
140if (Interlocked.Exchange(ref _completionMethodLock, 1) != 0) {
UI\LegacyPageAsyncTaskManager.cs (4)
203Interlocked.Increment(ref _tasksStarted); 252Interlocked.Increment(ref _tasksStarted); 314int newTasksCompleted = Interlocked.Increment(ref _tasksCompleted); 369if (timer != null && Interlocked.CompareExchange(ref _timeoutTimer, null, timer) == timer) {
Util\ActivityIdHelper.cs (1)
90*(long*)(&guidCopy) ^= Interlocked.Increment(ref _counter); // operate on the copy, not the original
Util\CancellationTokenHelper.cs (6)
47if (Interlocked.CompareExchange(ref _state, STATE_CANCELING, STATE_CREATED) == STATE_CREATED) { 59if (Interlocked.CompareExchange(ref _state, STATE_CANCELED, STATE_CANCELING) == STATE_DISPOSING) { 63Interlocked.Exchange(ref _state, STATE_DISPOSED); 73int originalState = Interlocked.Exchange(ref _state, STATE_DISPOSING); 81Interlocked.Exchange(ref _state, STATE_DISPOSED); 87Interlocked.Exchange(ref _state, STATE_DISPOSED);
Util\CountdownTask.cs (1)
36int newCount = Interlocked.Add(ref _pendingCount, delta);
Util\DisposableAction.cs (1)
26Action continuation = Interlocked.Exchange(ref _disposeAction, null);
Util\ReadWriteSpinLock.cs (5)
128int n = Interlocked.Decrement(ref _bits); 152test = Interlocked.CompareExchange(ref _bits, newBits, oldBits); 196test = Interlocked.CompareExchange(ref _bits, newBits, oldBits); 214test = Interlocked.CompareExchange(ref _bits, newBits, oldBits); 238if (Interlocked.CompareExchange(ref _bits, oldBits + 1, oldBits) == oldBits) {
Util\SafeBitVector32.cs (2)
39int result = Interlocked.CompareExchange(ref _data, newData, oldData); 66int result = Interlocked.CompareExchange(ref _data, newData, oldData);
Util\SynchronizationHelper.cs (5)
40get { return Interlocked.CompareExchange(ref _currentThread, null, null); } 41set { Interlocked.Exchange(ref _currentThread, value); } 48int newOperationCount = Interlocked.Add(ref _operationsInFlight, addend); 51Task completionTask = Interlocked.Exchange(ref _completionTask, null); 213Interlocked.Exchange(ref _completionTask, new Task(continuation));
WebSockets\AspNetWebSocket.cs (1)
210if (Interlocked.Exchange(ref _abortAsyncCalled, 1) == 0) {
System.Web.Extensions (1)
Handlers\ScriptModule.cs (1)
116if (Interlocked.Exchange(ref _isHandlerRegistered, 1) == 0) {
System.Web.Services (7)
System\Web\Services\Configuration\WebServicesSection.cs (1)
39Interlocked.CompareExchange(ref classSyncObject, o, null);
System\Web\Services\Diagnostics\TraceUtility.cs (1)
32Interlocked.CompareExchange(ref internalSyncObject, o, null);
System\Web\Services\Protocols\ClientProtocol.cs (1)
76Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
System\Web\Services\Protocols\RemoteDebugger.cs (1)
32Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
System\Web\Services\Protocols\ServerProtocol.cs (2)
38Interlocked.CompareExchange(ref s_InternalSyncObject, o, null); 280return item.Pressure < threshold ? Interlocked.Increment(ref item.Pressure) >= threshold : false;
System\Web\Services\Protocols\WebServiceHandler.cs (1)
237if (System.Threading.Interlocked.Increment(ref this.asyncCallbackCalls) == 1) {
System.Windows.Forms (3)
winforms\Managed\System\WinForms\MenuItem.cs (1)
918uniqueID = (uint)Interlocked.Increment(ref nextUniqueID);
winforms\Managed\System\WinForms\Screen.cs (2)
235Interlocked.Exchange(ref currentDesktopChangedCount, Screen.DesktopChangedCount); 471Interlocked.Increment(ref desktopChangedCount);
System.Workflow.ComponentModel (1)
AuthoringOM\Serializer\FormatterServicesNoSerializableCheck.cs (1)
51Interlocked.CompareExchange(ref s_FormatterServicesSyncObject, o, null);
System.Workflow.Runtime (2)
WorkBatch.cs (2)
321return Threading.Interlocked.Read(ref _workItemOrderId); 335return Threading.Interlocked.Increment(ref _workItemOrderId);
System.WorkflowServices (1)
System\ServiceModel\Activities\Description\WorkflowRuntimeEndpoint.cs (1)
42string endpointUri = String.Format(CultureInfo.InvariantCulture, "{0}/{1}", baseUri, Interlocked.Increment(ref uriCounter));
System.Xml (10)
System\Xml\Schema\FacetChecker.cs (1)
1111Interlocked.CompareExchange(ref languagePattern, langRegex, null);
System\Xml\Schema\Preprocessor.cs (1)
414Interlocked.CompareExchange<XmlSchema>(ref builtInSchemaForXmlNS, tempSchema, null);
System\Xml\Schema\XmlSchema.cs (1)
493schemaId = Interlocked.Increment(ref globalIdCounter);
System\Xml\Schema\XmlSchemaSet.cs (1)
73Interlocked.CompareExchange<Object>(ref internalSyncObject, o, null);
System\Xml\Schema\XmlSchemaValidator.cs (4)
2074Interlocked.CompareExchange<XmlSchemaAttribute>(ref xsiTypeSO, tempXsiTypeSO, null); 2081Interlocked.CompareExchange<XmlSchemaAttribute>(ref xsiNilSO, tempxsiNilSO, null); 2089Interlocked.CompareExchange<XmlSchemaAttribute>(ref xsiSLSO, tempxsiSLSO, null); 2097Interlocked.CompareExchange<XmlSchemaAttribute>(ref xsiNoNsSLSO, tempxsiNoNsSLSO, null);
System\Xml\XmlCharType.cs (1)
401Interlocked.CompareExchange<object>( ref s_Lock, o, null );
System\Xml\XmlUrlResolver.cs (1)
27Interlocked.CompareExchange<object>( ref s_DownloadManager, dm, null );
System.Xml.Linq (9)
System\Xml\Linq\XLinq.cs (8)
440Interlocked.CompareExchange(ref namespaces, new XHashtable<WeakReference>(ExtractNamespace, NamespacesCapacity), null); 508Interlocked.CompareExchange(ref refNmsp, new WeakReference(new XNamespace(namespaceName)), refOld); 682entryIdx = Interlocked.CompareExchange(ref buckets[bucketIdx], FullList, EndOfList); 693entryIdx = Interlocked.CompareExchange(ref entries[entryIdx].Next, FullList, EndOfList); 781newEntry = Interlocked.Increment(ref numEntries); 807entryIndex = Interlocked.CompareExchange(ref buckets[hashCode & (buckets.Length - 1)], newEntry, EndOfList); 809entryIndex = Interlocked.CompareExchange(ref entries[entryIndex].Next, newEntry, EndOfList); 2362Interlocked.CompareExchange<object>(ref content, t, s);
System\Xml\Linq\XNodeNavigator.cs (1)
760System.Threading.Interlocked.CompareExchange(ref XmlNamespaceDeclaration, new XAttribute(XNamespace.Xmlns.GetName("xml"), XNamespace.xmlPrefixNamespace), null);
WindowsBase (9)
Base\MS\Internal\ShutDownListener.cs (1)
144if (Interlocked.Exchange(ref _inShutDown, 1) == 0)
Base\MS\Internal\WeakEventTable.cs (2)
206if (Interlocked.Increment(ref _cleanupRequests) == 1) 283Interlocked.Exchange(ref _cleanupRequests, 0);
Base\System\Collections\ObjectModel\WeakReadOnlyCollection.cs (1)
140System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
Base\System\Windows\Threading\DispatcherObject.cs (1)
63Interlocked.CompareExchange<Dispatcher>(ref _sentinelDispatcher, sentinelDispatcher, null);
Base\System\Windows\WeakEventManager.cs (2)
884return (Interlocked.Increment(ref _users) != 1); 892Interlocked.Decrement(ref _users);
Shared\MS\Internal\ReaderWriterLockWrapper.cs (2)
172Interlocked.Exchange<NonPumpingSynchronizationContext>(ref _defaultSynchronizationContext, null); 198Interlocked.Exchange<NonPumpingSynchronizationContext>(ref _defaultSynchronizationContext, nonPumpingSynchronizationContext);