79 references to Exchange
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\BufferedReceiveBinder.cs (2)
209Interlocked.Exchange(ref binder._pendingOperationSemaphore, 0); 251Interlocked.Exchange(ref binder._pendingOperationSemaphore, 0);
Microsoft.AspNetCore.Server.HttpSys (3)
AsyncAcceptContext.cs (1)
131var value = Interlocked.Exchange(ref _expectedCompletionCount, 1); // should have been 0
MessagePump.cs (2)
178if (Interlocked.Exchange(ref _shutdownSignalCompleted, 1) == 0) 186if (Interlocked.Exchange(ref _stopping, 1) == 1)
Microsoft.AspNetCore.Server.Kestrel.Core (15)
Internal\Http\Http1ContentLengthMessageBody.cs (5)
39return new ReadResult(_readResult.Buffer, Interlocked.Exchange(ref _userCanceled, 0) == 1, isCompleted: true); 98if (!_readResult.IsCanceled || Interlocked.Exchange(ref _userCanceled, 0) == 1 || _cannotResetInputPipe) 126readResult = new ReadResult(_readResult.Buffer, Interlocked.Exchange(ref _userCanceled, 0) == 1, isCompleted: true); 146if (!_readResult.IsCanceled || Interlocked.Exchange(ref _userCanceled, 0) == 1 || _cannotResetInputPipe) 256Interlocked.Exchange(ref _userCanceled, 1);
Internal\Http\Http1UpgradeMessageBody.cs (4)
45Interlocked.Exchange(ref _userCanceled, 1); 68} while (readResult.IsCanceled && Interlocked.Exchange(ref _userCanceled, 0) == 0); 88} while (readResult.IsCanceled && Interlocked.Exchange(ref _userCanceled, 0) == 0); 99while (readResult.IsCanceled && Interlocked.Exchange(ref _userCanceled, 0) == 0)
Internal\Http2\Http2Connection.cs (2)
1403Interlocked.Exchange(ref _enhanceYourCalmCount, 0); 1823if (Interlocked.Exchange(ref _isClosed, 1) == 0)
Internal\Http3\Http3Connection.cs (1)
149if (Interlocked.Exchange(ref _stoppedAcceptingStreams, 1) == 0)
Internal\Http3\Http3ControlStream.cs (1)
110if (Interlocked.Exchange(ref _isClosed, 1) == 0)
Internal\Http3\Http3Stream.cs (1)
573if (Interlocked.Exchange(ref _isClosed, 1) == 0)
Internal\KestrelServerImpl.cs (1)
241if (Interlocked.Exchange(ref _stopping, 1) == 1)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
src\Servers\Kestrel\Transport.Sockets\src\Internal\IOQueue.cs (1)
57if (Interlocked.Exchange(ref _doingWork, 1) == 1)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
Internal\NamedPipeConnectionListener.cs (1)
167if (Interlocked.Exchange(ref _disposed, 1) == 0)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Internal\IOQueue.cs (1)
57if (Interlocked.Exchange(ref _doingWork, 1) == 1)
Microsoft.AspNetCore.SignalR.Client.Core (1)
Internal\InvocationRequest.cs (1)
45return Activity != null && Interlocked.Exchange(ref _isActivityStopping, 1) == 0;
Microsoft.Build (1)
BackEnd\BuildManager\BuildSubmission.cs (1)
109bool hasCompleted = (Interlocked.Exchange(ref CompletionInvoked, 1) == 1);
Microsoft.CodeAnalysis (2)
CodeGen\PrivateImplementationDetails.cs (1)
148var wasFrozen = Interlocked.Exchange(ref _frozen, 1);
ReferenceManager\CommonReferenceManager.State.cs (1)
449Interlocked.Exchange(ref _isBound, 1);
Microsoft.CodeAnalysis.EditorFeatures (2)
CodeActions\IUIThreadOperationContextExtensions.cs (2)
32Interlocked.Exchange(ref _totalItems, 0); 33Interlocked.Exchange(ref _completedItems, 0);
Microsoft.CodeAnalysis.LanguageServer (1)
ServerConfigurationFactory.cs (1)
68Interlocked.Exchange(ref _currentLogLevel, (int)level);
Microsoft.DotNet.RemoteExecutor (1)
RemoteInvokeHandle.cs (1)
219Interlocked.Exchange(ref s_clrMdLock, 0);
Microsoft.Extensions.Caching.Hybrid (1)
Internal\DefaultHybridCache.Debug.cs (1)
35=> flush ? Interlocked.Exchange(ref _outstandingBufferCount, 0) : Volatile.Read(ref _outstandingBufferCount);
Microsoft.Extensions.Diagnostics (1)
Metrics\DebugConsoleMetricListener.cs (1)
32if (instrument.IsObservable && Interlocked.Exchange(ref _timerStarted, 1) == 0)
Microsoft.Extensions.Logging.AzureAppServices (1)
BatchingLoggerProvider.cs (1)
100var messagesDropped = Interlocked.Exchange(ref _messagesDropped, 0);
Microsoft.Maui (2)
Animations\Animation.cs (2)
155 if (0 == Interlocked.Exchange(ref _usingResource, 1)) 165 Interlocked.Exchange(ref _usingResource, 0);
Microsoft.VisualStudio.LanguageServices (1)
EditAndContinue\EditAndContinueFeedbackDiagnosticFileProvider.cs (1)
120if (Interlocked.Exchange(ref _isLogCollectionInProgress, 0) == 1)
PresentationFramework (1)
MS\Internal\Data\DataBindEngine.cs (1)
595Interlocked.Exchange(ref _cleanupRequests, 0);
System.Collections.Concurrent (2)
System\Collections\Concurrent\ConcurrentBag.cs (2)
878Interlocked.Exchange(ref _tailIndex, --tail); 991Interlocked.Exchange(ref _headIndex, unchecked(head + 1));
System.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionPool.cs (1)
658Interlocked.Exchange(ref _pendingOpensWaiting, 0);
System.IO.Pipelines (2)
System\IO\Pipelines\SequencePipeReader.cs (2)
46Interlocked.Exchange(ref _cancelNext, 1); 78bool isCancellationRequested = Interlocked.Exchange(ref _cancelNext, 0) == 1;
System.Linq.Parallel (3)
System\Linq\Parallel\Channels\AsynchronousChannel.cs (2)
305Interlocked.Exchange(ref _producerBufferIndex, (bufferIndex + 1) % _buffer.Length); 621Interlocked.Exchange(ref _consumerBufferIndex, (consumerBufferIndex + 1) % _buffer.Length);
System\Linq\Parallel\Scheduling\QueryTaskGroupState.cs (1)
89if (Interlocked.Exchange(ref _alreadyEnded, 1) == 0)
System.Net.Http (4)
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (4)
139return Interlocked.Exchange(ref _readAheadTaskStatus, ReadAheadTask_CompletionReserved) == ReadAheadTask_Started; 198|| Interlocked.Exchange(ref _readAheadTaskStatus, ReadAheadTask_CompletionReserved) == ReadAheadTask_Started; 208Interlocked.Exchange(ref _readAheadTaskStatus, ReadAheadTask_Started) == ReadAheadTask_CompletionReserved) 281return Interlocked.Exchange(ref _readAheadTaskStatus, ReadAheadTask_Completed) == ReadAheadTask_Started;
System.Net.ServerSentEvents (1)
System\Net\ServerSentEvents\SseParser_1.cs (1)
465if (Interlocked.Exchange(ref _used, 1) != 0)
System.Private.CoreLib (11)
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.GateThread.cs (1)
214int numRunsMask = Interlocked.Exchange(ref threadPoolInstance._separated.gateThreadRunningState, GetRunningStateForNumRuns(MaxRuns));
src\libraries\System.Private.CoreLib\src\System\Threading\SpinLock.cs (1)
519Interlocked.Exchange(ref _owner, LOCK_UNOWNED);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs (1)
380Interlocked.Exchange(ref m_stateFlags, m_stateFlags | (int)TaskStateFlags.RanToCompletion);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (4)
2093Interlocked.Exchange(ref m_stateFlags, m_stateFlags | completionState); 2293int prevState = Interlocked.Exchange(ref m_stateFlags, m_stateFlags | (int)TaskStateFlags.Canceled); 3306Interlocked.Exchange(ref m_stateFlags, m_stateFlags | (int)TaskStateFlags.Canceled); 6915public bool TryStart() => Interlocked.Exchange(ref _enumerated, 1) == 0;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskFactory.cs (1)
2297Interlocked.Exchange(ref _stateFlags, isSyncBlockingFlag | CompletedFlag) == isSyncBlockingFlag)
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (2)
265Interlocked.Exchange(ref m_tailIndex, tail); 331Interlocked.Exchange(ref m_headIndex, head + 1);
src\System\Threading\Interlocked.CoreCLR.cs (1)
55return Exchange(ref location1, value); // Must expand intrinsic
System.Reflection.Metadata (1)
System\Reflection\Internal\Utilities\PinnedObject.cs (1)
43if (Interlocked.Exchange(ref _isValid, 0) != 0)
System.Runtime.Caching (11)
System\Runtime\Caching\CacheExpires.cs (2)
799if (Interlocked.Exchange(ref _inFlush, 1) == 0) 821Interlocked.Exchange(ref _inFlush, 0);
System\Runtime\Caching\CacheUsage.cs (2)
877if (Interlocked.Exchange(ref _inFlush, 1) == 0) 902Interlocked.Exchange(ref _inFlush, 0);
System\Runtime\Caching\MemoryCache.cs (1)
449if (Interlocked.Exchange(ref _disposed, 1) == 0)
System\Runtime\Caching\MemoryCacheStatistics.cs (5)
271if (Interlocked.Exchange(ref _inCacheManagerThread, 1) != 0) 331Interlocked.Exchange(ref _inCacheManagerThread, 0); 337if (Interlocked.Exchange(ref _disposed, 1) == 0) 385while (Interlocked.Exchange(ref _inCacheManagerThread, 1) != 0) 406Interlocked.Exchange(ref _inCacheManagerThread, 0);
System\Runtime\Caching\MemoryCacheStore.cs (1)
254if (Interlocked.Exchange(ref _disposed, 1) == 0)
System.Security.Cryptography (1)
src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdfImplementationManaged.cs (1)
64if (Interlocked.Exchange(ref _disposed, 1) == 0)
System.Transactions.Local (2)
System\Transactions\CommittableTransaction.cs (1)
128if (Interlocked.Exchange(ref _disposed, Transaction._disposedTrueValue) == Transaction._disposedTrueValue)
System\Transactions\Transaction.cs (1)
828if (Interlocked.Exchange(ref _disposed, Transaction._disposedTrueValue) == Transaction._disposedTrueValue)
System.Windows.Forms (2)
System\Windows\Forms\Application.ThreadContext.cs (1)
270if (Interlocked.Exchange(ref _disposed, 1) == 1)
System\Windows\Forms\Screen.cs (1)
189Interlocked.Exchange(ref _currentDesktopChangedCount, DesktopChangedCount);