248 references to Exchange
Aspire.Dashboard (1)
Utils\CancellationSeries.cs (1)
60using var priorCts = Interlocked.Exchange(ref _cts, next);
ClientSample (1)
Tcp\SocketAwaitable.cs (1)
66var continuation = Interlocked.Exchange(ref _callback, _callbackCompleted);
Metrics (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Metrics.Legacy (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.AspNetCore.Components.Endpoints (1)
DependencyInjection\HotReloadService.cs (1)
39var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.Components.WebAssembly (1)
Hosting\WebAssemblyHostConfiguration.cs (1)
132var previousToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
487Interlocked.Exchange(ref _cacheExpirationTokenSource, new CancellationTokenSource())?.Cancel();
Microsoft.AspNetCore.Mvc (1)
HotReloadService.cs (1)
78var current = Interlocked.Exchange(ref _tokenSource, new CancellationTokenSource());
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
363ReleaseConnection(Interlocked.Exchange(ref _cache, null));
Microsoft.AspNetCore.Routing.Tests (2)
Builder\RoutingEndpointConventionBuilderExtensionsTest.cs (2)
312var conventions = Interlocked.Exchange(ref _conventions, null); 322var finallyConventions = Interlocked.Exchange(ref _finallyConventions, null);
Microsoft.AspNetCore.Server.IIS (3)
Core\IO\AsyncIOEngine.cs (3)
222Interlocked.Exchange(ref _cachedAsyncReadOperation, null) ?? 226Interlocked.Exchange(ref _cachedAsyncWriteOperation, null) ?? 230Interlocked.Exchange(ref _cachedAsyncFlushOperation, null) ??
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Internal\CertificatePathWatcher.cs (1)
203var previousToken = Interlocked.Exchange(ref _reloadToken, new());
Internal\Infrastructure\StreamCloseAwaitable.cs (1)
43Interlocked.Exchange(ref _callback, _callbackCompleted)?.Invoke();
Microsoft.AspNetCore.SignalR.Client.Core (1)
src\SignalR\common\Shared\TimerAwaitable.cs (1)
76var continuation = Interlocked.Exchange(ref _callback, _callbackCompleted);
Microsoft.Build (3)
Definition\ProjectCollection.cs (1)
850set => Interlocked.Exchange(ref _link, value)?.Disconnected(this);
InterningBinaryReader.cs (1)
213Buffer buffer = Interlocked.Exchange(ref s_bufferPool, null);
Logging\BaseConsoleLogger.cs (1)
1208StringBuilder shared = Interlocked.Exchange(ref _sharedStringBuilder, null);
Microsoft.Build.Framework (5)
BuildException\BuildExceptionSerializationHelper.cs (1)
65if (Interlocked.Exchange(ref s_exceptionFactories, exceptionFactories) != null)
ImmutableSegmentedDictionary`2+PrivateInterlocked.cs (1)
28var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
ImmutableSegmentedList`1+PrivateInterlocked.cs (1)
28var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
ReuseableStringBuilder.cs (2)
258StringBuilder? returned = Interlocked.Exchange(ref s_sharedBuilder, null); 339var oldSharedBuilder = Interlocked.Exchange(ref s_sharedBuilder, returningBuilder);
Microsoft.Build.Tasks.Core (1)
InterningBinaryReader.cs (1)
213Buffer buffer = Interlocked.Exchange(ref s_bufferPool, null);
Microsoft.CodeAnalysis (8)
CommandLine\TouchedFileLogger.cs (2)
67var readFiles = Interlocked.Exchange( 92var writtenFiles = Interlocked.Exchange(
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (1)
104var symWriter = Interlocked.Exchange(ref _symWriter, null);
InternalUtilities\SemaphoreSlimExtensions.cs (1)
48var semaphoreToDispose = Interlocked.Exchange(ref _semaphore, null);
MetadataReference\AssemblyMetadata.cs (1)
373var previousData = Interlocked.Exchange(ref _lazyData, Data.Disposed);
MetadataReference\ModuleMetadata.cs (1)
296var onDispose = Interlocked.Exchange(ref _onDispose, null);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
StrongName\StrongNameKeys.cs (1)
160Interlocked.Exchange(ref s_lastSeenKeyPair, cachedKeyPair);
Microsoft.CodeAnalysis.Analyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.CodeAnalysis.AnalyzerUtilities (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.CodeAnalysis.BannedApiAnalyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.CodeAnalysis.CodeStyle (9)
src\Compilers\Core\Portable\InternalUtilities\SemaphoreSlimExtensions.cs (1)
48var semaphoreToDispose = Interlocked.Exchange(ref _semaphore, null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
29var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
29var set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
29var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
src\Dependencies\Threading\CancellationSeries.cs (1)
116var source = Interlocked.Exchange(ref _cts, null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.cs (1)
34return Interlocked.Exchange(ref s_currentLogger, logger);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CancellableLazy`1.cs (2)
58Interlocked.Exchange<Func<CancellationToken, T>?>(ref _valueFactory, null); 61Interlocked.Exchange(ref _gate, null);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\MefWorkspaceServices.cs (1)
74var allLanguageServices = Interlocked.Exchange(ref _languageServicesMap, _languageServicesMap.Clear());
Microsoft.CodeAnalysis.Collections.Package (4)
Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
29var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
29var set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
29var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
Microsoft.CodeAnalysis.CSharp (2)
Symbols\AliasSymbol.cs (1)
329bool won = Interlocked.Exchange(ref _aliasTargetDiagnostics, newDiagnostics) == null;
Symbols\Metadata\PE\PENestedNamespaceSymbol.cs (1)
137Interlocked.Exchange(ref _typesByNS, null);
Microsoft.CodeAnalysis.EditorFeatures (3)
Adornments\GraphicsResult.cs (1)
23=> Interlocked.Exchange(ref _dispose, null)?.Invoke();
QuickInfo\DisposableToolTip.cs (1)
26=> Interlocked.Exchange(ref _workspaceOpt, null)?.Dispose();
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (1)
57var oldTagTrees = Interlocked.Exchange(
Microsoft.CodeAnalysis.Features (3)
EditAndContinue\DebuggingSession.cs (3)
185if (Interlocked.Exchange(ref _pendingUpdate, null) != null) 199var previousPendingUpdate = Interlocked.Exchange(ref _pendingUpdate, update); 210var pendingUpdate = Interlocked.Exchange(ref _pendingUpdate, null);
Microsoft.CodeAnalysis.InteractiveHost (8)
Interactive\Core\InteractiveHost.cs (2)
125Interlocked.Exchange(ref _lazyRemoteService, null)?.Dispose(); 338var oldService = Interlocked.Exchange(ref _lazyRemoteService, newService);
src\Compilers\Core\Portable\InternalUtilities\SemaphoreSlimExtensions.cs (1)
48var semaphoreToDispose = Interlocked.Exchange(ref _semaphore, null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
29var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
29var set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
29var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
src\Dependencies\Threading\CancellationSeries.cs (1)
116var source = Interlocked.Exchange(ref _cts, null);
Microsoft.CodeAnalysis.PublicApiAnalyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.CodeAnalysis.ResxSourceGenerator (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Microsoft.CodeAnalysis.Threading.Package (5)
CancellationSeries.cs (1)
116var source = Interlocked.Exchange(ref _cts, null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
29var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
29var set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
29var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Metadata\PE\PENestedNamespaceSymbol.vb (1)
127Interlocked.Exchange(_typesByNS, Nothing)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Completion\VisualBasicCompletionService.vb (1)
70Interlocked.Exchange(_latestRules, newRules)
Microsoft.CodeAnalysis.Workspaces (8)
Shared\TestHooks\AsynchronousOperationListener.cs (1)
133var oldSource = Interlocked.Exchange(ref _expeditedDelayCancellationTokenSource, new CancellationTokenSource());
src\Compilers\Core\Portable\InternalUtilities\SemaphoreSlimExtensions.cs (1)
48var semaphoreToDispose = Interlocked.Exchange(ref _semaphore, null);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
src\Dependencies\Threading\CancellationSeries.cs (1)
116var source = Interlocked.Exchange(ref _cts, null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.cs (1)
34return Interlocked.Exchange(ref s_currentLogger, logger);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CancellableLazy`1.cs (2)
58Interlocked.Exchange<Func<CancellationToken, T>?>(ref _valueFactory, null); 61Interlocked.Exchange(ref _gate, null);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\MefWorkspaceServices.cs (1)
74var allLanguageServices = Interlocked.Exchange(ref _languageServicesMap, _languageServicesMap.Clear());
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (5)
src\Compilers\Core\Portable\InternalUtilities\SemaphoreSlimExtensions.cs (1)
48var semaphoreToDispose = Interlocked.Exchange(ref _semaphore, null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
29var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
29var set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
29var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
153Interlocked.Exchange(ref _builder, null)?.Free();
Microsoft.Extensions.Caching.Hybrid (1)
Internal\RecyclableArrayBufferWriter.cs (1)
55RecyclableArrayBufferWriter<T> obj = Interlocked.Exchange(ref _spare, null) ?? new();
Microsoft.Extensions.Caching.Memory (2)
CacheEntry.CacheEntryTokens.cs (1)
117List<PostEvictionCallbackRegistration>? callbackRegistrations = Interlocked.Exchange(ref entry._tokens._postEvictionCallbacks, null);
MemoryCache.cs (1)
348CoherentState oldState = Interlocked.Exchange(ref _coherentState, new CoherentState());
Microsoft.Extensions.Caching.StackExchangeRedis (1)
RedisCache.cs (1)
624ReleaseConnection(Interlocked.Exchange(ref _cache, null));
Microsoft.Extensions.Configuration (3)
ConfigurationManager.cs (1)
119var previousToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
ConfigurationProvider.cs (1)
117ConfigurationReloadToken previousToken = Interlocked.Exchange(ref _reloadToken, new ConfigurationReloadToken());
ConfigurationRoot.cs (1)
94ConfigurationReloadToken previousToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
Microsoft.Extensions.Logging.EventSource (1)
LoggingEventSource.cs (1)
395CancellationTokenSource? tcs = Interlocked.Exchange(ref _cancellationTokenSource, null);
Microsoft.Extensions.ML (3)
ModelLoaders\FileModelLoader.cs (1)
72var previousToken = Interlocked.Exchange(ref _reloadToken, new ModelReloadToken());
ModelLoaders\UriModelLoader.cs (1)
85var previousToken = Interlocked.Exchange(ref _reloadToken, new ModelReloadToken());
PoolLoader.cs (1)
45Interlocked.Exchange(ref _pool, new DefaultObjectPool<PredictionEngine<TData, TPrediction>>(predictionEnginePolicy));
Microsoft.Extensions.Primitives (1)
ChangeToken.cs (1)
147Interlocked.Exchange(ref _disposable, _disposedSentinel)?.Dispose();
Microsoft.Maui (1)
Platform\ActionDisposable.cs (1)
18 Interlocked.Exchange(ref _action, null)?.Invoke();
Microsoft.Maui.Controls (2)
ImageSource.cs (1)
129 TaskCompletionSource<bool> tcs = Interlocked.Exchange(ref _completionSource, null);
Shell\ShellNavigatingDeferral.cs (1)
21 var taskToComplete = Interlocked.Exchange(ref _completed, null);
Microsoft.Maui.Graphics.Skia (1)
SkiaImage.cs (1)
143 var previousValue = Interlocked.Exchange(ref _image, null);
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (1)
src\Graphics\src\Graphics\Platforms\Windows\PlatformImage.cs (1)
46 var bitmap = Interlocked.Exchange(ref _bitmap, null);
Microsoft.ML.Core (2)
Environment\ConsoleEnvironment.cs (1)
448_oldConsoleWriter = Interlocked.Exchange(ref _root._consoleWriter, _newConsoleWriter);
Utilities\Contracts.cs (1)
239return Interlocked.Exchange(ref _handler, handler);
Microsoft.ML.CpuMath (1)
src\Microsoft.ML.Core\Utilities\Contracts.cs (1)
239return Interlocked.Exchange(ref _handler, handler);
Microsoft.VisualStudio.IntegrationTest.Setup (1)
AsyncCompletionTracker.cs (1)
72if (Interlocked.Exchange(ref cancellationSource, null) is { } source)
Microsoft.VisualStudio.LanguageServices.CSharp (1)
SemanticSearch\SemanticSearchToolWindowImpl.cs (1)
408var source = Interlocked.Exchange(ref cancellationSource, null);
MSBuild (1)
InterningBinaryReader.cs (1)
213Buffer buffer = Interlocked.Exchange(ref s_bufferPool, null);
MSBuildTaskHost (4)
BuildExceptionSerializationHelper.cs (1)
65if (Interlocked.Exchange(ref s_exceptionFactories, exceptionFactories) != null)
Concurrent\ConcurrentDictionary.cs (2)
208Interlocked.Exchange(ref tables._buckets[bucketNo], newNode); 227Interlocked.Exchange(ref tables._buckets[bucketNo], new Node(key, value, hashcode, tables._buckets[bucketNo]));
InterningBinaryReader.cs (1)
213Buffer buffer = Interlocked.Exchange(ref s_bufferPool, null);
PresentationFramework (3)
MS\Internal\Data\CollectionViewProxy.cs (1)
170IndexedEnumerable indexer = (IndexedEnumerable)Interlocked.Exchange(ref _indexer, null);
MS\Internal\Data\DataBindEngine.cs (1)
618HybridDictionary asyncDispatchers = (HybridDictionary)Interlocked.Exchange(ref _asyncDispatchers, null);
System\Windows\Data\CollectionView.cs (1)
1427IndexedEnumerable wrapper = (IndexedEnumerable) Interlocked.Exchange(ref _enumerableWrapper, null);
Roslyn.Diagnostics.Analyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
System.Collections.Concurrent (2)
System\Collections\Concurrent\ConcurrentBag.cs (2)
729Interlocked.Exchange(ref _currentOp, Operation.Add); 752Interlocked.Exchange(ref _currentOp, Operation.Add); // ensure subsequent reads aren't reordered before this
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\DiagnosticListener.cs (1)
186subscriber = Interlocked.Exchange(ref _subscriptions, subscriber);
System.Formats.Cbor (1)
System\Formats\Cbor\Reader\CborReader.String.cs (1)
520List<(int Offset, int Length)>? ranges = Interlocked.Exchange(ref _indefiniteLengthStringRangeAllocation, null);
System.IO.Compression (1)
System\IO\Compression\DeflateZLib\DeflateStream.cs (1)
1107if (Interlocked.Exchange(ref _activeAsyncOperation, true))
System.IO.Compression.Brotli (1)
System\IO\Compression\BrotliStream.cs (1)
185if (Interlocked.Exchange(ref _activeAsyncOperation, true))
System.IO.Pipes (1)
System\IO\Pipes\NamedPipeServerStream.Unix.cs (1)
138Interlocked.Exchange(ref _instance, null)?.Dispose(disposing); // interlocked to avoid shared state problems from erroneous double/concurrent disposes
System.Linq.Expressions (1)
System\Runtime\CompilerServices\CallSite.cs (1)
190matchmaker = Interlocked.Exchange(ref _cachedMatchmaker, null);
System.Linq.Parallel (2)
System\Linq\Parallel\Channels\AsynchronousChannel.cs (2)
344Interlocked.Exchange(ref _producerIsWaiting, true); 561Interlocked.Exchange(ref _consumerIsWaiting, true);
System.Net.Http (9)
System\Net\Http\HttpClient.cs (1)
681CancellationTokenSource currentCts = Interlocked.Exchange(ref _pendingRequestsCts, new CancellationTokenSource());
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
1575Http2Stream? http2Stream = Interlocked.Exchange(ref _http2Stream, null);
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (3)
621if (Interlocked.Exchange(ref _haveServerControlStream, true)) 637if (Interlocked.Exchange(ref _haveServerQpackDecodeStream, true)) 648if (Interlocked.Exchange(ref _haveServerQpackEncodeStream, true))
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (2)
1424Http3RequestStream? stream = Interlocked.Exchange(ref _stream, null); 1451Http3RequestStream? stream = Interlocked.Exchange(ref _stream, null);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
100if (!Interlocked.Exchange(ref _disposed, true))
System\Net\Http\SocketsHttpHandler\HttpContentReadStream.cs (1)
55if (Interlocked.Exchange(ref _disposed, true))
System.Net.Mail (2)
System\Net\Mail\SmtpClient.cs (2)
753if (Interlocked.Exchange(ref ctrSet, true)) 786if (Interlocked.Exchange(ref ctrSet, true))
System.Net.Quic (5)
src\libraries\Common\src\System\Net\StreamBuffer.cs (2)
315if (Interlocked.Exchange(ref _hasWaiter, false)) 325if (Interlocked.Exchange(ref _hasWaiter, false))
System\Net\Quic\QuicConnection.cs (1)
827if (Interlocked.Exchange(ref _disposed, true))
System\Net\Quic\QuicListener.cs (1)
408if (Interlocked.Exchange(ref _disposed, true))
System\Net\Quic\QuicStream.cs (1)
715if (Interlocked.Exchange(ref _disposed, true))
System.Net.Requests (6)
System\Net\HttpWebRequest.cs (5)
998if (Interlocked.Exchange(ref _abortCalled, true)) 1144if (Interlocked.Exchange(ref _beginGetRequestStreamCalled, true)) 1166if (Interlocked.Exchange(ref _endGetRequestStreamCalled, true)) 1417if (Interlocked.Exchange(ref _beginGetResponseCalled, true)) 1437if (Interlocked.Exchange(ref _endGetResponseCalled, true))
System\Net\TimerThread.cs (1)
455internal override bool Cancel() => !Interlocked.Exchange(ref _canceled, true);
System.Net.Security (12)
src\libraries\Common\src\System\Net\Security\SSPIHandleCache.cs (1)
30Interlocked.Exchange(ref s_cacheSlots[index], newRef)?.Dispose();
System\Net\Security\NegotiateStream.cs (3)
343if (Interlocked.Exchange(ref _readInProgress, true)) 509if (Interlocked.Exchange(ref _writeInProgress, true)) 727if (Interlocked.Exchange(ref _authInProgress, true))
System\Net\Security\SslStream.cs (2)
731var manager = Interlocked.Exchange(ref field, null) ?? new PoolingPointerMemoryManager(); 746if (Interlocked.Exchange(ref _nestedRead, NestedState.StreamInUse) == NestedState.StreamInUse)
System\Net\Security\SslStream.IO.cs (6)
65if (Interlocked.Exchange(ref _nestedRead, NestedState.StreamDisposed) == NestedState.StreamNotInUse && 66Interlocked.Exchange(ref _nestedAuth, NestedState.StreamDisposed) == NestedState.StreamNotInUse) 80if (Interlocked.Exchange(ref _connectionOpenedStatus, ConnectionStatus.Disposed) == ConnectionStatus.HandshakeCompleted) 207if (Interlocked.Exchange(ref _nestedWrite, NestedState.StreamInUse) != NestedState.StreamNotInUse) 291if (Interlocked.Exchange(ref _nestedAuth, NestedState.StreamInUse) == NestedState.StreamInUse) 970if (Interlocked.Exchange(ref _nestedWrite, NestedState.StreamInUse) == NestedState.StreamInUse)
System.Net.Sockets (30)
System\Net\Sockets\NetworkStream.cs (1)
390if (Interlocked.Exchange(ref _disposed, true))
System\Net\Sockets\SafeSocketHandle.cs (1)
57private bool TryOwnClose() => !Interlocked.Exchange(ref _ownClose, true);
System\Net\Sockets\Socket.cs (1)
3397if (Interlocked.Exchange(ref _disposed, true))
System\Net\Sockets\Socket.Tasks.cs (18)
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) ?? 954Interlocked.Exchange(ref _multiBufferReceiveEventArgs, null)?.Dispose(); 955Interlocked.Exchange(ref _multiBufferSendEventArgs, null)?.Dispose(); 956Interlocked.Exchange(ref _singleBufferReceiveEventArgs, null)?.Dispose(); 957Interlocked.Exchange(ref _singleBufferSendEventArgs, null)?.Dispose();
System\Net\Sockets\SocketAsyncContext.Unix.cs (6)
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) ?? 258Debug.Assert(!Interlocked.Exchange(ref _callbackQueued, true), $"Unexpected _callbackQueued: {_callbackQueued}");
System\Net\Sockets\SocketAsyncEngine.Unix.cs (1)
237Interlocked.Exchange(
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
891public bool ReachedCoordinationPointFirst() => !Interlocked.Exchange(ref _isCompleted, true);
System\Net\Sockets\TCPClient.cs (1)
267if (!Interlocked.Exchange(ref _disposed, true))
System.Net.WebProxy (1)
System\Net\WebProxy.NonWasm.cs (1)
56if (Interlocked.Exchange(ref s_networkChangeRegistered, true))
System.Net.WebSockets.Client (1)
System\Net\WebSockets\ClientWebSocket.cs (1)
195if (Interlocked.Exchange(ref _state, InternalState.Disposed) != InternalState.Disposed)
System.Private.CoreLib (20)
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.ThreadPoolValueTaskSource.cs (1)
23Interlocked.Exchange(ref _reusableThreadPoolValueTaskSource, null) ?? new ThreadPoolValueTaskSource(this);
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (3)
224if (Interlocked.Exchange(ref buckets[i].Array, null) is T[] buffer) 265if (Interlocked.Exchange(ref buckets[i].Array, null) is T[] buffer && 286if (!Interlocked.Exchange(ref _trimCallbackCreated, true))
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Debug.cs (1)
26return Interlocked.Exchange(ref s_provider, provider);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ActivityTracker.cs (1)
186if (!Interlocked.Exchange(ref activityToStop.m_stopped, true))
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEnumerable.cs (1)
45return Interlocked.Exchange(ref _enumerator, null) ?? new DelegateEnumerator(this, isNormalized: false);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ConditionalWeakTable.cs (1)
422ConditionalWeakTable<TKey, TValue>? table = Interlocked.Exchange(ref _table, null);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (1)
312(box = Interlocked.Exchange<StateMachineBox<TStateMachine>?>(ref slot, null)) is null)
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (5)
562ManualResetEvent? mre = Interlocked.Exchange<ManualResetEvent?>(ref _kernelEvent!, null); 741Registrations? registrations = Interlocked.Exchange(ref _registrations, null); 744Interlocked.Exchange(ref _state, States.NotifyingCompleteState); 1171if (Interlocked.Exchange(ref value, true)) 1179do { sw.SpinOnce(); } while (Interlocked.Exchange(ref value, true));
src\libraries\System.Private.CoreLib\src\System\Threading\ReaderWriterLockSlim.cs (1)
1539return !Interlocked.Exchange(ref _isLocked, true);
src\libraries\System.Private.CoreLib\src\System\Threading\RegisteredWaitHandle.Portable.cs (1)
78Interlocked.Exchange(ref s_cachedEvent, null) ??
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
6648if ((task1 = Interlocked.Exchange(ref _task1, null)) != null)
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (2)
623if (Interlocked.Exchange( 1485Debug.Assert(!Interlocked.Exchange(ref _executed, true), "A QueueUserWorkItemCallback was called twice!");
src\libraries\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.cs (1)
104Interlocked.Exchange(ref dataArray![dataIndex], data);
System.Reflection.Metadata (6)
System\Reflection\Internal\MemoryBlocks\ByteArrayMemoryProvider.cs (1)
26Interlocked.Exchange(ref _pinned, null)?.Dispose();
System\Reflection\Internal\MemoryBlocks\MemoryMappedFileBlock.cs (2)
50Interlocked.Exchange(ref _safeBuffer, null)?.ReleasePointer(); 51Interlocked.Exchange(ref _accessor, null)?.Dispose();
System\Reflection\Internal\MemoryBlocks\StreamMemoryBlockProvider.cs (2)
54Interlocked.Exchange(ref _stream, null!)?.Dispose(); 57Interlocked.Exchange(ref _lazyMemoryMap, null)?.Dispose();
System\Reflection\Metadata\Internal\VirtualHeap.cs (1)
56var blobs = Interlocked.Exchange(ref _blobs, null);
System.Runtime.InteropServices (1)
System\Runtime\InteropServices\Marshalling\ComObject.cs (1)
86if (UniqueInstance && !Interlocked.Exchange(ref _released, true))
System.Security.Cryptography (2)
System\Security\Cryptography\X509Certificates\CertCollectionLoader.cs (1)
30List<ICertificatePal>? localCerts = Interlocked.Exchange(ref _certs, null);
System\Security\Cryptography\X509Certificates\OpenSslSingleCertLoader.cs (1)
28ICertificatePal? localCert = Interlocked.Exchange(ref _cert, null);
System.Text.Json (3)
System\Text\Json\Document\JsonDocument.cs (2)
74byte[]? extraRentedBytes = Interlocked.Exchange<byte[]?>(ref _extraRentedArrayPoolBytes, null); 86PooledByteBufferWriter? extraBufferWriter = Interlocked.Exchange<PooledByteBufferWriter?>(ref _extraPooledByteBufferWriter, null);
System\Text\Json\Document\JsonDocument.MetadataDb.cs (1)
153byte[]? data = Interlocked.Exchange(ref _data, null!);
System.Text.RegularExpressions (3)
System\Text\RegularExpressions\Regex.cs (3)
424RegexRunner runner = Interlocked.Exchange(ref _runner, null) ?? CreateRunner(); 469RegexRunner runner = Interlocked.Exchange(ref _runner, null) ?? CreateRunner(); 532RegexRunner runner = Interlocked.Exchange(ref _runner, null) ?? CreateRunner();
System.Threading.RateLimiting (1)
System\Threading\RateLimiting\TimerAwaitable.cs (1)
89Action? continuation = Interlocked.Exchange(ref _callback, _callbackCompleted);
System.Threading.Tasks.Dataflow (1)
Internal\SpscTargetCore.cs (1)
255Task? previousConsumer = Interlocked.Exchange<Task?>(ref _activeConsumer, null);
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\ParallelRangeManager.cs (1)
160Interlocked.Exchange(ref _indexRanges[_nCurrentIndexRange]._bRangeFinished, true);
System.Windows.Forms.Primitives (2)
System\Windows\Forms\ObjectCache.cs (2)
32item = Interlocked.Exchange(ref _itemsCache[i], null); 51temp = Interlocked.Exchange(ref _itemsCache[i], temp);
Test.Utilities (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
Text.Analyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporaryDictionary`2.cs (1)
34Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\TemporarySet`1.cs (1)
33Interlocked.Exchange(ref _storage, null)?.Free(cancellationToken);