1260 references to Interlocked
BasicWebSite (2)
ClientSample (2)
HttpStress (3)
ILCompiler.DependencyAnalysisFramework (3)
InMemory.FunctionalTests (3)
InProcessWebSite (4)
Interop.FunctionalTests (5)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Components (1)
Microsoft.AspNetCore.Components.Endpoints (1)
Microsoft.AspNetCore.Components.Server (1)
Microsoft.AspNetCore.Components.Tests (2)
Microsoft.AspNetCore.Components.WebAssembly (2)
Microsoft.AspNetCore.ConcurrencyLimiter (3)
Microsoft.AspNetCore.ConcurrencyLimiter.Microbenchmarks (2)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
Microsoft.AspNetCore.Cryptography.Internal (2)
Microsoft.AspNetCore.DataProtection (2)
Microsoft.AspNetCore.DataProtection.Extensions (1)
Microsoft.AspNetCore.Hosting (4)
Microsoft.AspNetCore.Http (4)
Microsoft.AspNetCore.Http.Connections (5)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
Microsoft.AspNetCore.Mvc (1)
Microsoft.AspNetCore.Mvc.Core (2)
Microsoft.AspNetCore.Mvc.RazorPages (1)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (2)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (1)
Microsoft.AspNetCore.Routing.Tests (2)
Microsoft.AspNetCore.Server.HttpSys (10)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
Microsoft.AspNetCore.Server.IIS (6)
Microsoft.AspNetCore.Server.Kestrel.Core (51)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (4)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (9)
Microsoft.AspNetCore.Shared.Tests (1)
Microsoft.AspNetCore.SignalR.Client.Core (2)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
Microsoft.Build (31)
Microsoft.Build.Engine (10)
Microsoft.Build.Engine.OM.UnitTests (9)
Microsoft.Build.Engine.UnitTests (3)
Microsoft.Build.Framework (8)
Microsoft.Build.Tasks.Core (3)
Microsoft.Build.Tasks.UnitTests (1)
Microsoft.Build.UnitTests.Shared (1)
Microsoft.CSharp (1)
Microsoft.DotNet.RemoteExecutor (2)
Microsoft.Extensions.Caching.Hybrid (7)
Microsoft.Extensions.Caching.Hybrid.Tests (21)
Microsoft.Extensions.Caching.Memory (14)
Microsoft.Extensions.Caching.MicroBenchmarks (2)
Microsoft.Extensions.Caching.StackExchangeRedis (2)
Microsoft.Extensions.Configuration (5)
Microsoft.Extensions.DependencyInjection (1)
Microsoft.Extensions.Diagnostics (1)
Microsoft.Extensions.Logging.Abstractions (1)
Microsoft.Extensions.Logging.AzureAppServices (2)
Microsoft.Extensions.Logging.EventSource (3)
Microsoft.Extensions.ObjectPool (5)
Microsoft.Extensions.Options (1)
Microsoft.Extensions.Primitives (2)
Microsoft.JSInterop (3)
Microsoft.NET.StringTools (1)
MonoAOTCompiler (1)
MonoTargetsTasks (1)
MSBuild (5)
MSBuildTaskHost (11)
mscorlib (1)
netstandard (1)
PresentationCore (13)
PresentationFramework (22)
SignalR.Client.FunctionalTestApp (1)
Sockets.FunctionalTests (1)
System.Collections (1)
System.Collections.Concurrent (22)
System.Collections.Immutable (21)
System\Collections\Immutable\ImmutableInterlocked.cs (16)
49T interlockedResult = Interlocked.CompareExchange(ref location, newValue, oldValue);
93T interlockedResult = Interlocked.CompareExchange(ref location, newValue, oldValue);
135T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray);
179T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray);
199return new ImmutableArray<T>(Interlocked.Exchange(ref Unsafe.AsRef(in location.array), value.array));
213return new ImmutableArray<T>(Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), value.array, comparand.array));
313ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
361ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
408ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
442ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
477ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
508ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
542ImmutableStack<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
565ImmutableStack<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
597ImmutableQueue<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
620ImmutableQueue<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
System.ComponentModel.Composition (12)
System.ComponentModel.Composition.Registration (3)
System.ComponentModel.TypeConverter (7)
System.Composition.Hosting (1)
System.Console (2)
System.Data.Common (13)
System.Diagnostics.DiagnosticSource (37)
System\Diagnostics\Activity.cs (15)
234Interlocked.CompareExchange(ref _id, id, null);
266Interlocked.CompareExchange(ref _parentId, parentId, null);
270Interlocked.CompareExchange(ref _parentId, Parent.Id, null);
305Interlocked.CompareExchange(ref _rootId, rootId, null);
473if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(kvp), null) != null)
497if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(kvp, set: true), null) != null)
512if (_events != null || Interlocked.CompareExchange(ref _events, new DiagLinkedList<ActivityEvent>(e), null) != null)
531if (_links != null || Interlocked.CompareExchange(ref _links, new DiagLinkedList<ActivityLink>(link), null) != null)
552if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(kvp), null) != null)
576if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(kvp, set: true), null) != null)
832Interlocked.CompareExchange(ref _spanId, spanId, null);
912Interlocked.CompareExchange(ref _parentSpanId, parentSpanId, null);
1053Interlocked.CompareExchange(ref _customProperties, new Dictionary<string, object>(), null);
1228ret = AppendSuffix(Parent.Id, Interlocked.Increment(ref Parent._currentChildId).ToString(), '.');
1245ret = AppendSuffix(parentId, Interlocked.Increment(ref s_currentRootId).ToString("x"), '_');
System\Diagnostics\Metrics\AggregatorStore.cs (9)
141if (Interlocked.CompareExchange(ref _stateUnion, newState, null) is null)
158if (Interlocked.CompareExchange(ref _stateUnion, newState, state) == state)
177if (Interlocked.CompareExchange(ref _stateUnion, newState, null) is null)
194if (Interlocked.CompareExchange(ref _stateUnion, newState, state) == state)
250Interlocked.CompareExchange(ref NoLabelAggregator, aggregator, null);
266Interlocked.CompareExchange(ref Label1, new FixedSizeLabelNameDictionary<StringSequence1, ObjectSequence1, TAggregator>(), null);
273Interlocked.CompareExchange(ref Label2, new FixedSizeLabelNameDictionary<StringSequence2, ObjectSequence2, TAggregator>(), null);
280Interlocked.CompareExchange(ref Label3, new FixedSizeLabelNameDictionary<StringSequence3, ObjectSequence3, TAggregator>(), null);
287Interlocked.CompareExchange(ref LabelMany, new FixedSizeLabelNameDictionary<StringSequenceMany, ObjectSequenceMany, TAggregator>(), null);
System.Diagnostics.Process (3)
System.Diagnostics.TraceSource (2)
System.Formats.Cbor (1)
System.IO.Compression (4)
System.IO.Compression.Brotli (1)
System.IO.Pipelines (2)
System.IO.Pipes (2)
System.Linq.Expressions (11)
System.Linq.Parallel (9)
System.Net.Http (47)
System\Net\Http\HttpTelemetry.AnyOS.cs (9)
51_startedRequestsCounter ??= new PollingCounter("requests-started", this, () => Interlocked.Read(ref _startedRequests))
57_startedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-started-rate", this, () => Interlocked.Read(ref _startedRequests))
67_failedRequestsCounter ??= new PollingCounter("requests-failed", this, () => Interlocked.Read(ref _failedRequests))
73_failedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-failed-rate", this, () => Interlocked.Read(ref _failedRequests))
82_currentRequestsCounter ??= new PollingCounter("current-requests", this, () => -Interlocked.Read(ref _stoppedRequests) + Interlocked.Read(ref _startedRequests))
87_totalHttp11ConnectionsCounter ??= new PollingCounter("http11-connections-current-total", this, () => Interlocked.Read(ref _openedHttp11Connections))
92_totalHttp20ConnectionsCounter ??= new PollingCounter("http20-connections-current-total", this, () => Interlocked.Read(ref _openedHttp20Connections))
97_totalHttp30ConnectionsCounter ??= new PollingCounter("http30-connections-current-total", this, () => Interlocked.Read(ref _openedHttp30Connections))
System.Net.HttpListener (12)
System\Net\Managed\HttpEndPointListener.cs (6)
332} while (Interlocked.CompareExchange(ref _unhandledPrefixes, future, current) != current);
344} while (Interlocked.CompareExchange(ref _allPrefixes, future, current) != current);
358} while (Interlocked.CompareExchange(ref _prefixes, p2, prefs) != prefs);
373} while (Interlocked.CompareExchange(ref _unhandledPrefixes, future, current) != current);
387} while (Interlocked.CompareExchange(ref _allPrefixes, future, current) != current);
401} while (Interlocked.CompareExchange(ref _prefixes, p2, prefs) != prefs);
System.Net.Mail (12)
System.Net.NameResolution (5)
System.Net.Quic (18)
System\Net\Quic\QuicStream.cs (7)
324if (totalCopied > 0 && Interlocked.CompareExchange(ref _receivedNeedsEnable, 0, 1) == 1)
399if (Interlocked.CompareExchange(ref _sendLocked, 1, 0) == 0)
419Interlocked.CompareExchange(ref _sendException, exception, null);
485Interlocked.CompareExchange(ref _sendException, exception, null);
486if (Interlocked.CompareExchange(ref _sendLocked, 1, 0) == 0)
561return (_receiveBuffers.HasCapacity() && Interlocked.CompareExchange(ref _receivedNeedsEnable, 0, 1) == 1) ? QUIC_STATUS_CONTINUE : QUIC_STATUS_SUCCESS;
700if (Interlocked.Exchange(ref _disposed, 1) != 0)
System.Net.Requests (17)
System.Net.Security (39)
System\Net\Security\NetSecurityTelemetry.cs (21)
46_tlsHandshakeRateCounter ??= new IncrementingPollingCounter("tls-handshake-rate", this, () => Interlocked.Read(ref _finishedTlsHandshakes))
52_totalTlsHandshakesCounter ??= new PollingCounter("total-tls-handshakes", this, () => Interlocked.Read(ref _finishedTlsHandshakes))
57_currentTlsHandshakesCounter ??= new PollingCounter("current-tls-handshakes", this, () => -Interlocked.Read(ref _finishedTlsHandshakes) + Interlocked.Read(ref _startedTlsHandshakes))
62_failedTlsHandshakesCounter ??= new PollingCounter("failed-tls-handshakes", this, () => Interlocked.Read(ref _failedTlsHandshakes))
67_sessionsOpenCounter ??= new PollingCounter("all-tls-sessions-open", this, () => Interlocked.Read(ref _sessionsOpen))
72_sessionsOpenTls10Counter ??= new PollingCounter("tls10-sessions-open", this, () => Interlocked.Read(ref _sessionsOpenTls10))
77_sessionsOpenTls11Counter ??= new PollingCounter("tls11-sessions-open", this, () => Interlocked.Read(ref _sessionsOpenTls11))
82_sessionsOpenTls12Counter ??= new PollingCounter("tls12-sessions-open", this, () => Interlocked.Read(ref _sessionsOpenTls12))
87_sessionsOpenTls13Counter ??= new PollingCounter("tls13-sessions-open", this, () => Interlocked.Read(ref _sessionsOpenTls13))
128Interlocked.Increment(ref _startedTlsHandshakes);
156Interlocked.Increment(ref _finishedTlsHandshakes);
157Interlocked.Increment(ref _failedTlsHandshakes);
170Interlocked.Increment(ref _finishedTlsHandshakes);
205Interlocked.Increment(ref protocolSessionsOpen);
206Interlocked.Increment(ref _sessionsOpen);
225count = Interlocked.Decrement(ref _sessionsOpenTls10);
229count = Interlocked.Decrement(ref _sessionsOpenTls11);
234count = Interlocked.Decrement(ref _sessionsOpenTls12);
238count = Interlocked.Decrement(ref _sessionsOpenTls13);
244count = Interlocked.Decrement(ref _sessionsOpen);
System\Net\Security\SslStream.IO.cs (10)
61if (Interlocked.Exchange(ref _nestedRead, StreamDisposed) == StreamNotInUse &&
62Interlocked.Exchange(ref _nestedAuth, StreamDisposed) == StreamNotInUse)
76if (Interlocked.Exchange(ref _connectionOpenedStatus, 2) == 1)
136bool connectionOpen = Interlocked.CompareExchange(ref _connectionOpenedStatus, 1, 0) == 0;
168if (Interlocked.CompareExchange(ref _nestedAuth, StreamInUse, StreamNotInUse) != StreamNotInUse)
174if (Interlocked.CompareExchange(ref _nestedRead, StreamInUse, StreamNotInUse) != StreamNotInUse)
181if (Interlocked.Exchange(ref _nestedWrite, StreamInUse) != StreamNotInUse)
265if (Interlocked.Exchange(ref _nestedAuth, StreamInUse) == StreamInUse)
802if (Interlocked.CompareExchange(ref _nestedRead, StreamInUse, StreamNotInUse) != StreamNotInUse)
944if (Interlocked.Exchange(ref _nestedWrite, StreamInUse) == StreamInUse)
System.Net.Sockets (56)
System\Net\Sockets\Socket.Tasks.cs (20)
62Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
95Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null) ??
262Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
320Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null) ??
348TaskSocketAsyncEventArgs<int>? saea = Interlocked.Exchange(ref _multiBufferReceiveEventArgs, null);
410Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null) ??
450Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null) ??
511Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null) ??
566Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
584Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
612TaskSocketAsyncEventArgs<int>? saea = Interlocked.Exchange(ref _multiBufferSendEventArgs, null);
674Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
704Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
782Interlocked.Exchange(ref _singleBufferSendEventArgs, null) ??
945if (Interlocked.CompareExchange(ref cache, saea, null) != null)
954Interlocked.Exchange(ref _multiBufferReceiveEventArgs, null)?.Dispose();
955Interlocked.Exchange(ref _multiBufferSendEventArgs, null)?.Dispose();
956Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null)?.Dispose();
957Interlocked.Exchange(ref _singleBufferSendEventArgs, null)?.Dispose();
1033if (Interlocked.CompareExchange(ref cache, this, null) != null)
System\Net\Sockets\SocketAsyncContext.Unix.cs (9)
92Interlocked.Exchange(ref _cachedAcceptOperation, null) ??
96Interlocked.Exchange(ref _cachedBufferMemoryReceiveOperation, null) ??
100Interlocked.Exchange(ref _cachedBufferListReceiveOperation, null) ??
104Interlocked.Exchange(ref _cachedBufferMemorySendOperation, null) ??
108Interlocked.Exchange(ref _cachedBufferListSendOperation, null) ??
157int oldState = Interlocked.CompareExchange(ref _state, (int)State.Running, (int)State.Waiting);
185if (state == Interlocked.CompareExchange(ref _state, newState, state))
221if (state == Interlocked.CompareExchange(ref _state, newState, state))
258Debug.Assert(Interlocked.CompareExchange(ref _callbackQueued, 1, 0) == 0, $"Unexpected _callbackQueued: {_callbackQueued}");
System\Net\Sockets\SocketsTelemetry.cs (15)
82Interlocked.Increment(ref _currentOutgoingConnectAttempts);
93long newCount = Interlocked.Decrement(ref _currentOutgoingConnectAttempts);
99Interlocked.Increment(ref _outgoingConnectionsEstablished);
133Interlocked.Increment(ref _incomingConnectionsEstablished);
147Interlocked.Add(ref _bytesReceived, count);
154Interlocked.Add(ref _bytesSent, count);
160Interlocked.Increment(ref _datagramsReceived);
166Interlocked.Increment(ref _datagramsSent);
175_currentOutgoingConnectAttemptsCounter ??= new PollingCounter("current-outgoing-connect-attempts", this, () => Interlocked.Read(ref _currentOutgoingConnectAttempts))
179_outgoingConnectionsEstablishedCounter ??= new PollingCounter("outgoing-connections-established", this, () => Interlocked.Read(ref _outgoingConnectionsEstablished))
183_incomingConnectionsEstablishedCounter ??= new PollingCounter("incoming-connections-established", this, () => Interlocked.Read(ref _incomingConnectionsEstablished))
187_bytesReceivedCounter ??= new PollingCounter("bytes-received", this, () => Interlocked.Read(ref _bytesReceived))
191_bytesSentCounter ??= new PollingCounter("bytes-sent", this, () => Interlocked.Read(ref _bytesSent))
195_datagramsReceivedCounter ??= new PollingCounter("datagrams-received", this, () => Interlocked.Read(ref _datagramsReceived))
199_datagramsSentCounter ??= new PollingCounter("datagrams-sent", this, () => Interlocked.Read(ref _datagramsSent))
System.Net.WebClient (5)
System.Net.WebProxy (1)
System.Net.WebSockets (3)
System.Net.WebSockets.Client (4)
System.Private.CoreLib (213)
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (10)
146Interlocked.CompareExchange(ref s_userDefaultCulture, GetUserDefaultCulture(), null);
152Interlocked.CompareExchange(ref s_userDefaultUICulture, GetUserDefaultUICulture(), null);
390Interlocked.CompareExchange(ref s_asyncLocalCurrentCulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentCulture), null);
412Interlocked.CompareExchange(ref s_asyncLocalCurrentUICulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentUICulture), null);
531Interlocked.CompareExchange<CultureInfo?>(ref _parent, culture, null);
727Interlocked.CompareExchange(ref _numInfo, temp, null);
753Interlocked.CompareExchange(ref _dateTimeInfo, temp, null);
858Interlocked.MemoryBarrier();
1152cache = Interlocked.CompareExchange(ref s_cachedCulturesByName, cache, null) ?? cache;
1167cache = Interlocked.CompareExchange(ref s_cachedCulturesByLcid, cache, null) ?? cache;
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (10)
100if (Interlocked.CompareExchange(ref _kernelEvent, mre, null) != null)
444ITimer? currentTimer = Interlocked.CompareExchange(ref _timer, timer, null);
558ManualResetEvent? mre = Interlocked.Exchange<ManualResetEvent?>(ref _kernelEvent!, null);
605registrations = Interlocked.CompareExchange(ref _registrations, registrations, null) ?? registrations;
707Interlocked.CompareExchange(ref _state, NotifyingState, NotCanceledState) == NotCanceledState)
737Registrations? registrations = Interlocked.Exchange(ref _registrations, null);
740Interlocked.Exchange(ref _state, NotifyingCompleteState);
829Interlocked.Exchange(ref registrations.ExecutingCallbackId, 0); // for safety, prevent reorderings crossing this point and seeing inconsistent state.
1167if (Interlocked.Exchange(ref value, 1) != 0)
1175do { sw.SpinOnce(); } while (Interlocked.Exchange(ref value, 1) == 1);
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (4)
202return (IntPtr)Interlocked.Exchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value);
220return (UIntPtr)Interlocked.Exchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value);
392return (IntPtr)Interlocked.CompareExchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value, (long)comparand);
411return (UIntPtr)Interlocked.CompareExchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value, (long)comparand);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (31)
191Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ??
696(Interlocked.CompareExchange(ref m_stateFlags, oldFlags | newBits, oldFlags) == oldFlags ||
706int oldFlags = Interlocked.CompareExchange(ref m_stateFlags, flags | newBits, flags);
721oldFlags = Interlocked.CompareExchange(ref m_stateFlags, flags | newBits, flags);
753Interlocked.And(ref m_stateFlags, ~(int)TaskStateFlags.WaitCompletionNotification);
887Interlocked.Increment(ref props.m_completionCountdown);
899Interlocked.Decrement(ref props.m_completionCountdown);
968if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null)
1068if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null)
1170newId = Interlocked.Increment(ref s_taskIdCounter);
1197Interlocked.CompareExchange(ref m_taskId, newId, 0);
1335Interlocked.CompareExchange(ref m_contingentProperties, new ContingentProperties(), null);
1485if (Interlocked.CompareExchange(ref contingentProps.m_completionEvent, newMre, null) != null)
1771if (Interlocked.CompareExchange(ref props.m_exceptionsHolder, holder, null) != null)
2005Interlocked.Decrement(ref props.m_completionCountdown) == 0) // Reaching this sub clause means there may be remaining active children,
2092Interlocked.Exchange(ref m_stateFlags, m_stateFlags | completionState);
2166Interlocked.CompareExchange(ref props.m_exceptionalChildren, new List<Task>(), null);
2183if (Interlocked.Decrement(ref props!.m_completionCountdown) == 0)
2292int prevState = Interlocked.Exchange(ref m_stateFlags, m_stateFlags | (int)TaskStateFlags.Canceled);
3281Interlocked.Exchange(ref m_stateFlags, m_stateFlags | (int)TaskStateFlags.Canceled);
3426object? continuationObject = Interlocked.Exchange(ref m_continuationObject, s_taskCompletionSentinel);
4544oldValue = Interlocked.CompareExchange(ref m_continuationObject, list, expected);
4601if ((m_continuationObject != null) || (Interlocked.CompareExchange(ref m_continuationObject, tc, null) != null))
4625continuationsLocalRef = Interlocked.CompareExchange(ref m_continuationObject, new List<object?>(), continuationObject);
5093if (Interlocked.Decrement(ref _count) == 0) Set();
6046object? failedOrCanceled = Interlocked.CompareExchange(ref m_stateObject, completedTask, null);
6065failedOrCanceled = Interlocked.CompareExchange(ref m_stateObject, new List<Task> { first, completedTask }, first);
6079if (Interlocked.Decrement(ref _remainingToComplete) == 0)
6364if (Interlocked.Decrement(ref m_count) == 0)
6596if ((task1 = Interlocked.Exchange(ref _task1, null)) != null)
6845public bool TryStart() => Interlocked.Exchange(ref _enumerated, 1) == 0;
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (11)
40if (Interlocked.CompareExchange(ref s_queues, newQueues, oldQueues) == oldQueues)
80if (Interlocked.CompareExchange(ref s_queues, newQueues, oldQueues) == oldQueues)
264Interlocked.Exchange(ref m_tailIndex, tail);
330Interlocked.Exchange(ref m_headIndex, head + 1);
577if (Interlocked.CompareExchange(ref _separated.hasOutstandingThreadRequest, 1, 0) == 0)
591Interlocked.MemoryBarrier();
660Interlocked.CompareExchange(ref _mayHaveHighPriorityWorkItems, 0, 1) != 0 &&
1092if (Interlocked.CompareExchange(ref _isScheduledForProcessing, 1, 0) == 0)
1107Interlocked.MemoryBarrier();
1168Interlocked.MemoryBarrier(); // ensure that an old cached value is not read below
11790 == Interlocked.Exchange(ref executed, 1),
System.Private.DataContractSerialization (19)
System.Private.Uri (6)
System.Private.Xml (8)
System.Private.Xml.Linq (12)
System.Reflection.DispatchProxy (1)
System.Reflection.Metadata (18)
System.Reflection.MetadataLoadContext (7)
System.Runtime.Caching (28)
System.Runtime.InteropServices (3)
System.Runtime.Serialization.Formatters (1)
System.Security.Cryptography (10)
System.Text.Encoding.CodePages (4)
System.Text.Json (16)
System.Text.RegularExpressions (14)
System.Text.RegularExpressions.Generator (2)
System.Threading (26)
System\Threading\ReaderWriterLock.cs (21)
49_lockID = Interlocked.Increment(ref s_mostRecentLockID);
85if (Interlocked.CompareExchange(ref _state, LockStates.Reader, 0) == 0)
132currentState = Interlocked.CompareExchange(ref _state, knownState + LockStates.Reader, knownState);
186currentState = Interlocked.CompareExchange(ref _state, knownState + LockStates.WaitingReader, knownState);
215knownState = Interlocked.Add(ref _state, modifyState) - modifyState;
241Interlocked.Add(ref _state, LockStates.Reader - LockStates.ReaderSignaled);
264Interlocked.Add(ref _state, -LockStates.ReaderSignaled);
287if (Interlocked.CompareExchange(ref _state, LockStates.Writer, 0) == 0)
313currentState = Interlocked.CompareExchange(ref _state, knownState + LockStates.Writer, knownState);
356currentState = Interlocked.CompareExchange(ref _state, knownState + LockStates.WaitingWriter, knownState);
380knownState = Interlocked.Add(ref _state, modifyState) - modifyState;
407knownState = Interlocked.Add(ref _state, modifyState) - modifyState;
533currentState = Interlocked.CompareExchange(ref _state, knownState + modifyState, knownState);
641currentState = Interlocked.CompareExchange(ref _state, knownState + modifyState, knownState);
702int knownState = Interlocked.CompareExchange(ref _state, LockStates.Writer, LockStates.Reader);
811currentState = Interlocked.CompareExchange(ref _state, knownState + modifyState, knownState);
941if (Interlocked.CompareExchange(ref _state, LockStates.Writer, 0) == 0)
958Interlocked.CompareExchange(ref _state, knownState + LockStates.Reader, knownState) == knownState)
1026ManualResetEventSlim? previousEvent = Interlocked.CompareExchange(ref _readerEvent, currentEvent, null);
1047AutoResetEvent? previousEvent = Interlocked.CompareExchange(ref _writerEvent, currentEvent, null);
1099Interlocked.Add(ref _state, -LockStates.CachingEvents);
System.Threading.Channels (4)
System.Threading.RateLimiting (51)
System.Threading.Tasks.Dataflow (18)
Base\DataflowBlock.cs (7)
574Interlocked.CompareExchange(ref source._cancellationState, CANCELLATION_STATE_COMPLETING, CANCELLATION_STATE_REGISTERED) == CANCELLATION_STATE_REGISTERED)
673Interlocked.CompareExchange(ref _cancellationState, CANCELLATION_STATE_COMPLETING, curState) == curState))
700Interlocked.CompareExchange(ref _cancellationState, CANCELLATION_STATE_RESERVED, CANCELLATION_STATE_REGISTERED) == CANCELLATION_STATE_REGISTERED);
722if (Interlocked.CompareExchange(ref _cancellationState, CANCELLATION_STATE_REGISTERED, CANCELLATION_STATE_RESERVED) != CANCELLATION_STATE_RESERVED)
1119IDisposable? disposableUnlink = Interlocked.CompareExchange<IDisposable?>(ref target._unlink, null, unlink);
1270IDisposable? disposableUnlink = Interlocked.CompareExchange(ref _unlink, null, unlink);
1536if (cachedUnlinker != null && Interlocked.CompareExchange(ref _unlinker, null, cachedUnlinker) == cachedUnlinker)
System.Threading.Tasks.Parallel (19)
System\Threading\Tasks\Parallel.ForEachAsync.cs (6)
112sizeof(T) == sizeof(byte) ? Interlocked.CompareExchange(ref Unsafe.As<T, byte>(ref location), Unsafe.As<T, byte>(ref value), Unsafe.As<T, byte>(ref comparand)) == Unsafe.As<T, byte>(ref comparand) :
113sizeof(T) == sizeof(ushort) ? Interlocked.CompareExchange(ref Unsafe.As<T, ushort>(ref location), Unsafe.As<T, ushort>(ref value), Unsafe.As<T, ushort>(ref comparand)) == Unsafe.As<T, ushort>(ref comparand) :
114sizeof(T) == sizeof(uint) ? Interlocked.CompareExchange(ref Unsafe.As<T, uint>(ref location), Unsafe.As<T, uint>(ref value), Unsafe.As<T, uint>(ref comparand)) == Unsafe.As<T, uint>(ref comparand) :
115sizeof(T) == sizeof(ulong) ? Interlocked.CompareExchange(ref Unsafe.As<T, ulong>(ref location), Unsafe.As<T, ulong>(ref value), Unsafe.As<T, ulong>(ref comparand)) == Unsafe.As<T, ulong>(ref comparand) :
595Interlocked.Increment(ref _completionRefCount);
612public bool SignalWorkerCompletedIterating() => Interlocked.Decrement(ref _completionRefCount) == 0;
System\Threading\Tasks\ParallelLoopState.cs (3)
215Interlocked.CompareExchange(ref Unsafe.As<TInt, int>(ref pflags._lowestBreakIteration), Unsafe.As<TInt, int>(ref iteration), Unsafe.As<TInt, int>(ref oldLBI)) != Unsafe.As<TInt, int>(ref oldLBI) :
216Interlocked.CompareExchange(ref Unsafe.As<TInt, long>(ref pflags._lowestBreakIteration), Unsafe.As<TInt, long>(ref iteration), Unsafe.As<TInt, long>(ref oldLBI)) != Unsafe.As<TInt, long>(ref oldLBI))
320if (Interlocked.CompareExchange(ref _loopStateFlags, oldState | newState, oldState) == oldState)
System.Transactions.Local (29)
System.Xaml (19)
System\Xaml\XamlSchemaContext.cs (10)
361Interlocked.CompareExchange(ref _xmlNsCompatDict, CreateDictionary<string, string>(), null);
486Interlocked.CompareExchange(ref _masterBracketCharacterCache, CreateDictionary<XamlType, Dictionary<string, SpecialBracketCharacters>>(), null);
497Interlocked.CompareExchange(ref _masterTypeList, CreateDictionary<Type, XamlType>(ReferenceEqualityComparer.Instance), null);
508Interlocked.CompareExchange(ref _masterValueConverterList, CreateDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object>(), null);
519Interlocked.CompareExchange(ref _masterMemberList, CreateDictionary<ReferenceEqualityTuple<MemberInfo, MemberInfo>, XamlMember>(), null);
708Interlocked.CompareExchange(ref _xmlnsInfo, CreateDictionary<Assembly, XmlNsInfo>(ReferenceEqualityComparer.Instance), null);
719Interlocked.CompareExchange(ref _xmlnsInfoForDynamicAssemblies, CreateDictionary<WeakRefKey, XmlNsInfo>(), null);
731Interlocked.CompareExchange(ref _namespaceByUriList, CreateDictionary<string, XamlNamespace>(), null);
746Interlocked.CompareExchange(ref _xmlnsInfoForUnreferencedAssemblies, CreateDictionary<Assembly, XmlNsInfo>(ReferenceEqualityComparer.Instance), null);
1242Interlocked.CompareExchange(ref _referenceAssemblyNames, asmNames, null);
WasmAppBuilder (1)