409 references to Monitor
Aspire.Hosting (3)
ApplicationModel\ResourceLoggerService.cs (3)
436Debug.Assert(Monitor.IsEntered(_lock)); 447Debug.Assert(Monitor.IsEntered(_lock)); 462Debug.Assert(Monitor.IsEntered(_lock));
dotnet-svcutil-lib (13)
FrameworkFork\Microsoft.Xml\Xml\schema\Preprocessor.cs (3)
140Monitor.Enter(listSchema); 168Monitor.Exit(listSchema); 173Monitor.Exit(listSchema); //Release locks on all schema objects
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSet.cs (8)
412Monitor.TryEnter(InternalSyncObject, ref thisLockObtained); 415Monitor.TryEnter(schemas.InternalSyncObject, ref schemasLockObtained); 422Monitor.Exit(InternalSyncObject); //Give up this lock and try both again 473Monitor.Exit(InternalSyncObject); 477Monitor.Exit(schemas.InternalSyncObject); 641Monitor.Enter(currentSchema); 688Monitor.Exit(currentSchema); 692Monitor.Exit(currentSchema);
FrameworkFork\System.ServiceModel\Internals\System\Runtime\InternalBufferManager.cs (2)
294Monitor.TryEnter(_tuningLock, ref lockHeld); 308Monitor.Exit(_tuningLock);
Microsoft.AspNetCore.DataProtection (2)
KeyManagement\KeyRingProvider.cs (2)
248Monitor.TryEnter(_cacheableKeyRingLockObj, (existingCacheableKeyRing != null) ? 0 : Timeout.Infinite, ref acquiredLock); 320Monitor.Exit(_cacheableKeyRingLockObj);
Microsoft.Build (25)
BackEnd\BuildManager\BuildManager.cs (20)
677Debug.Assert(Monitor.IsEntered(_syncLock)); 1354Debug.Assert(!Monitor.IsEntered(_syncLock)); 1368Debug.Assert(Monitor.IsEntered(_syncLock)); 1470Debug.Assert(Monitor.IsEntered(_syncLock)); 1661Debug.Assert(!Monitor.IsEntered(_syncLock)); 1682Debug.Assert(!Monitor.IsEntered(_syncLock)); 1763Debug.Assert(!Monitor.IsEntered(_syncLock)); 2217Debug.Assert(Monitor.IsEntered(_syncLock)); 2250Debug.Assert(Monitor.IsEntered(_syncLock)); 2258Debug.Assert(Monitor.IsEntered(_syncLock)); 2375Debug.Assert(Monitor.IsEntered(_syncLock)); 2401Debug.Assert(Monitor.IsEntered(_syncLock)); 2478Debug.Assert(Monitor.IsEntered(_syncLock)); 2570Debug.Assert(Monitor.IsEntered(_syncLock)); 2619Debug.Assert(Monitor.IsEntered(_syncLock)); 2745Debug.Assert(Monitor.IsEntered(_syncLock)); 2771Debug.Assert(Monitor.IsEntered(_syncLock)); 2915Debug.Assert(Monitor.IsEntered(_syncLock)); 3179Debug.Assert(Monitor.IsEntered(_syncLock)); 3260Debug.Assert(Monitor.IsEntered(_syncLock));
BackEnd\Components\RequestBuilder\RequestBuilder.cs (3)
493ErrorUtilities.VerifyThrow(Monitor.IsEntered(monitorLockObject), "Not running under the given lock"); 513Monitor.Exit(monitorLockObject); 521Monitor.Enter(monitorLockObject);
ErrorUtilities.cs (1)
136if (!Monitor.IsEntered(locker))
Evaluation\ProjectRootElementCache.cs (1)
258!System.Threading.Monitor.IsEntered(_locker),
Microsoft.Build.Engine.OM.UnitTests (1)
ErrorUtilities.cs (1)
136if (!Monitor.IsEntered(locker))
Microsoft.Build.Tasks.Core (1)
ErrorUtilities.cs (1)
136if (!Monitor.IsEntered(locker))
Microsoft.Build.Utilities.Core (1)
ErrorUtilities.cs (1)
136if (!Monitor.IsEntered(locker))
Microsoft.CodeAnalysis.CodeStyle (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (4)
139Contract.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!"); 142Monitor.Enter(SyncObject); 152Contract.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject)); 153Monitor.Exit(asyncLazy.SyncObject);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (3)
130Monitor.Wait(_syncLock); 156Monitor.Pulse(_syncLock); 230Monitor.PulseAll(obj);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
BackgroundWorkIndicator\BackgroundWorkIndicatorScope.cs (1)
44Contract.ThrowIfFalse(Monitor.IsEntered(_context.Gate));
Microsoft.CodeAnalysis.InteractiveHost (7)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (4)
139Contract.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!"); 142Monitor.Enter(SyncObject); 152Contract.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject)); 153Monitor.Exit(asyncLazy.SyncObject);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (3)
130Monitor.Wait(_syncLock); 156Monitor.Pulse(_syncLock); 230Monitor.PulseAll(obj);
Microsoft.CodeAnalysis.Workspaces (8)
Options\GlobalOptionService.cs (1)
46Debug.Assert(!Monitor.IsEntered(_gate));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (4)
139Contract.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!"); 142Monitor.Enter(SyncObject); 152Contract.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject)); 153Monitor.Exit(asyncLazy.SyncObject);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (3)
130Monitor.Wait(_syncLock); 156Monitor.Pulse(_syncLock); 230Monitor.PulseAll(obj);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (2)
233Monitor.PulseAll(_completionSources); 248Monitor.Wait(_completionSources);
Microsoft.CSharp (1)
Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs (1)
129Debug.Assert(System.Threading.Monitor.IsEntered(s_bindLock));
Microsoft.Extensions.DependencyInjection (6)
ServiceLookup\CallSiteRuntimeResolver.cs (2)
123Monitor.Enter(sync, ref lockTaken); 148Monitor.Exit(sync);
ServiceLookup\ServiceLookupHelpers.cs (4)
32internal static readonly MethodInfo MonitorEnterMethodInfo = typeof(Monitor) 33.GetMethod(nameof(Monitor.Enter), BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof(object), typeof(bool).MakeByRefType() }, null)!; 34internal static readonly MethodInfo MonitorExitMethodInfo = typeof(Monitor) 35.GetMethod(nameof(Monitor.Exit), BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof(object) }, null)!;
Microsoft.Extensions.Http (2)
DefaultHttpClientFactory.cs (2)
255if (!Monitor.TryEnter(_cleanupActiveLock)) 306Monitor.Exit(_cleanupActiveLock);
Microsoft.Extensions.Logging.Console (7)
ConsoleLoggerProcessor.cs (7)
34Monitor.PulseAll(_messageQueue); 54Monitor.PulseAll(_messageQueue); 123Monitor.Wait(_messageQueue); 149Monitor.PulseAll(_messageQueue); 165Monitor.Wait(_messageQueue); 174Monitor.PulseAll(_messageQueue); 201Monitor.PulseAll(_messageQueue);
Microsoft.ML.Core (2)
Utilities\ThreadUtils.cs (2)
114Monitor.Pulse(_queue); 137if (!Monitor.Wait(_queue, IdleMilliseconds))
Microsoft.ML.Data (3)
DataLoadSave\Text\BlockingQueue.cs (3)
166Monitor.Pulse(this); 201if (!Monitor.Wait(this, millisecondsTimeout)) 224Monitor.PulseAll(this);
MSBuild (1)
ErrorUtilities.cs (1)
136if (!Monitor.IsEntered(locker))
MSBuildTaskHost (4)
Concurrent\ConcurrentDictionary.cs (4)
177lockTaken = Monitor.TryEnter(tables._locks[lockNo]); 247Monitor.Exit(tables._locks[lockNo]); 505lockTaken = Monitor.TryEnter(locks[i]); 526Monitor.Exit(_tables._locks[i]);
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1140[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.Monitor))]
netstandard (1)
netstandard.cs (1)
2090[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.Monitor))]
PresentationCore.Tests (2)
TestUtilities\BinaryFormatterScope.cs (2)
19Monitor.Enter(typeof(BinaryFormatterScope)); 31Monitor.Exit(typeof(BinaryFormatterScope));
PresentationFramework (2)
MS\Internal\Utility\MonitorWrapper.cs (2)
22Monitor.Enter(_syncRoot); 31Monitor.Exit(_syncRoot);
System.Collections.Concurrent (23)
System\Collections\Concurrent\ConcurrentBag.cs (14)
149Debug.Assert(Monitor.IsEntered(GlobalQueuesLock)); 321Debug.Assert(Monitor.IsEntered(GlobalQueuesLock)); 617Debug.Assert(!Monitor.IsEntered(GlobalQueuesLock)); 618Monitor.Enter(GlobalQueuesLock, ref lockTaken); 624Monitor.Enter(queue, ref queue._frozen); 644Debug.Assert(Monitor.IsEntered(GlobalQueuesLock) == lockTaken); 653Monitor.Exit(queue); 658Monitor.Exit(GlobalQueuesLock); 782Monitor.Enter(this, ref lockTaken); 836Monitor.Exit(this); 899Monitor.Enter(this, ref lockTaken); 926Monitor.Exit(this); 1027Debug.Assert(Monitor.IsEntered(this)); 1060Debug.Assert(Monitor.IsEntered(this));
System\Collections\Concurrent\ConcurrentDictionary.cs (9)
965Monitor.Enter(locks[lockNo], ref lockTaken); 1058Monitor.Exit(locks[lockNo]); 2110Debug.Assert(!Monitor.IsEntered(locks[0])); 2112Monitor.Enter(locks[0]); 2126Debug.Assert(Monitor.IsEntered(locks[0])); 2131Monitor.Enter(locks[i]); 2147Monitor.Exit(locks[i]); 2431Monitor.Enter(locks[lockNo], ref lockTaken); 2529Monitor.Exit(locks[lockNo]);
System.ComponentModel.Composition (2)
System\ComponentModel\Composition\Hosting\CompositionLock.cs (2)
67Monitor.Enter(_compositionLock); 76Monitor.Exit(_compositionLock);
System.Composition.Hosting (2)
System\Composition\Hosting\Core\CompositionOperation.cs (2)
91Monitor.Enter(sharingLock); 129Monitor.Exit(_sharingLock);
System.Configuration.ConfigurationManager (2)
System\Configuration\ClientConfigurationSystem.cs (2)
107Monitor.Wait(this); 189Monitor.PulseAll(this);
System.Console (1)
System\Console.cs (1)
198Debug.Assert(!Monitor.IsEntered(s_syncObject));
System.Data.Odbc (5)
Common\System\Data\ProviderBase\DbConnectionPool.cs (2)
1076Monitor.TryEnter(obj, ref locked); 1095Monitor.Exit(obj);
src\libraries\Common\src\System\Data\ProviderBase\DbConnectionFactory.cs (1)
134Debug.Assert(Monitor.IsEntered(s_pendingOpenNonPooled), $"Expected {nameof(s_pendingOpenNonPooled)} lock to be held.");
src\libraries\Common\src\System\Data\ProviderBase\DbReferenceCollection.cs (2)
272Monitor.TryEnter(_itemLock, LockPollTime, ref lockObtained); 280Monitor.Exit(_itemLock);
System.Diagnostics.DiagnosticSource (2)
System\Diagnostics\DiagnosticListener.cs (1)
360Debug.Assert(Monitor.IsEntered(s_allListenersLock)); // We should only be called when we hold this lock
System\Diagnostics\Metrics\RuntimeMetrics.cs (1)
94() => Monitor.LockContentionCount,
System.Diagnostics.Process (6)
System\Diagnostics\ProcessWaitState.Unix.cs (6)
238Debug.Assert(!Monitor.IsEntered(_gate)); 253Debug.Assert(Monitor.IsEntered(_gate)); 266Debug.Assert(!Monitor.IsEntered(_gate)); 348Debug.Assert(Monitor.IsEntered(_gate)); 397Debug.Assert(!Monitor.IsEntered(_gate)); 506Debug.Assert(Monitor.IsEntered(_gate));
System.Linq.Expressions (1)
System\Dynamic\Utils\ContractUtils.cs (1)
125Debug.Assert(Monitor.IsEntered(lockObject), "Expected lock is not held.");
System.Linq.Parallel (7)
System\Linq\Parallel\Merging\OrderPreservingPipeliningMergeHelper.cs (4)
366Monitor.Pulse(locks[i]); 410Monitor.Wait(bufferLock); 428Monitor.Pulse(bufferLock); 490Monitor.Pulse(bufferLock);
System\Linq\Parallel\Scheduling\OrderPreservingPipeliningSpoolingTask.cs (3)
127Monitor.Pulse(_bufferLock); 137Monitor.Wait(_bufferLock); 204Monitor.Pulse(_bufferLock);
System.Net.Http (28)
System\Net\Http\Headers\HttpHeaders.cs (2)
798Debug.Assert(Monitor.IsEntered(info)); 1218Debug.Assert(Monitor.IsEntered(info));
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
312Debug.Assert(!Monitor.IsEntered(_http11Connections)); 317public bool HasSyncObjLock => Monitor.IsEntered(_http11Connections);
System\Net\Http\SocketsHttpHandler\CreditManager.cs (1)
161Debug.Assert(Monitor.IsEntered(SyncObject), "Shouldn't be called outside lock.");
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (3)
268Debug.Assert(Monitor.IsEntered(SyncObject)); 369Debug.Assert(Monitor.IsEntered(SyncObject)); 748Debug.Assert(!Monitor.IsEntered(SyncObject));
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (18)
245Debug.Assert(!Monitor.IsEntered(SyncObject)); 287Debug.Assert(!Monitor.IsEntered(SyncObject)); 364Debug.Assert(Monitor.IsEntered(SyncObject)); 383Debug.Assert(Monitor.IsEntered(SyncObject)); 410Debug.Assert(!Monitor.IsEntered(SyncObject)); 453Debug.Assert(Monitor.IsEntered(SyncObject)); 619Debug.Assert(!Monitor.IsEntered(SyncObject)); 683Debug.Assert(!Monitor.IsEntered(SyncObject)); 763Debug.Assert(!Monitor.IsEntered(SyncObject)); 786Debug.Assert(!Monitor.IsEntered(SyncObject)); 869Debug.Assert(!Monitor.IsEntered(SyncObject)); 949Debug.Assert(!Monitor.IsEntered(SyncObject)); 1013Debug.Assert(Monitor.IsEntered(SyncObject)); 1034Debug.Assert(!Monitor.IsEntered(SyncObject)); 1108Debug.Assert(!Monitor.IsEntered(SyncObject)); 1376Debug.Assert(!Monitor.IsEntered(SyncObject)); 1421Debug.Assert(!Monitor.IsEntered(SyncObject)); 1459Debug.Assert(!Monitor.IsEntered(thisRef.SyncObject));
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (2)
66Debug.Assert(Monitor.IsEntered(SyncObj)); 130Debug.Assert(Monitor.IsEntered(SyncObj));
System.Net.NameResolution (1)
System\Net\Dns.cs (1)
700Debug.Assert(!Monitor.IsEntered(s_tasks));
System.Net.NetworkInformation (4)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (4)
24Debug.Assert(Monitor.IsEntered(s_gate)); 29Debug.Assert(Monitor.IsEntered(s_gate)); 152Debug.Assert(Monitor.IsEntered(s_gate)); 177Debug.Assert(Monitor.IsEntered(s_gate));
System.Net.Quic (8)
src\libraries\Common\src\System\Net\StreamBuffer.cs (8)
39Debug.Assert(!Monitor.IsEntered(SyncObject)); 51Debug.Assert(!Monitor.IsEntered(SyncObject)); 63Debug.Assert(!Monitor.IsEntered(SyncObject)); 80Debug.Assert(!Monitor.IsEntered(SyncObject)); 97Debug.Assert(!Monitor.IsEntered(SyncObject)); 179Debug.Assert(!Monitor.IsEntered(SyncObject)); 195Debug.Assert(!Monitor.IsEntered(SyncObject)); 258Debug.Assert(!Monitor.IsEntered(SyncObject));
System.Net.Sockets (4)
System\Net\Sockets\SocketAsyncContext.Unix.cs (4)
720Debug.Assert(!Monitor.IsEntered(_lockObject)); 723bool success = Monitor.TryEnter(_lockObject, 10000); 732Debug.Assert(Monitor.IsEntered(_lockObject)); 733Monitor.Exit(_lockObject);
System.Net.WebSockets (4)
System\Net\WebSockets\ManagedWebSocket.cs (2)
236Debug.Assert(Monitor.IsEntered(StateUpdateLock), $"Expected {nameof(StateUpdateLock)} to be held"); 465Debug.Assert(Monitor.IsEntered(StateUpdateLock), $"Expected {nameof(StateUpdateLock)} to be held");
System\Net\WebSockets\ManagedWebSocket.KeepAlive.cs (2)
236Debug.Assert(Monitor.IsEntered(StateUpdateLock)); 253Debug.Assert(Monitor.IsEntered(StateUpdateLock));
System.Private.CoreLib (62)
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (4)
396Monitor.Enter(this); 412Monitor.Exit(this); 420Monitor.Enter(this); 429Monitor.Exit(this);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (4)
111Debug.Assert(Monitor.IsEntered(s_counterGroupLock)); 152Debug.Assert(Monitor.IsEntered(s_counterGroupLock)); 188Debug.Assert(Monitor.IsEntered(s_counterGroupLock)); 204Debug.Assert(Monitor.IsEntered(s_counterGroupLock));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\DiagnosticCounter.cs (1)
117Debug.Assert(Monitor.IsEntered(this));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventCounter.cs (2)
80Debug.Assert(Monitor.IsEntered(this)); 174Debug.Assert(Monitor.IsEntered(this));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventDispatcher.cs (3)
68Debug.Assert(Monitor.IsEntered(m_dispatchControlLock)); 139Debug.Assert(Monitor.IsEntered(m_dispatchControlLock)); 149Debug.Assert(Monitor.IsEntered(m_dispatchControlLock));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (1)
165Debug.Assert(!Monitor.IsEntered(EventListener.EventListenersLock));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (5)
1539Debug.Assert(!Monitor.IsEntered(EventListener.EventListenersLock)); 2653Debug.Assert(Monitor.IsEntered(EventListener.EventListenersLock)); 2868Debug.Assert(Monitor.IsEntered(EventListener.EventListenersLock)); 4408Debug.Assert(!Monitor.IsEntered(EventListenersLock)); 4455Debug.Assert(Monitor.IsEntered(EventListenersLock));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSource.cs (1)
95_monitorContentionCounter ??= new IncrementingPollingCounter("monitor-lock-contention-count", this, () => Monitor.LockContentionCount) { DisplayName = "Monitor Lock Contention Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventHandleTable.cs (1)
41Debug.Assert(Monitor.IsEntered(this));
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (10)
341Debug.Assert(Monitor.IsEntered(this)); // uses _store 542Debug.Assert(Monitor.IsEntered(this)); // uses _store 562Debug.Assert(Monitor.IsEntered(this)); // uses _store 624Debug.Assert(Monitor.IsEntered(this)); // uses _store 644Debug.Assert(Monitor.IsEntered(this)); // uses _store 782Debug.Assert(!Monitor.IsEntered(this)); // only called during init 805Debug.Assert(!Monitor.IsEntered(this)); // only called during init 994Debug.Assert(Monitor.IsEntered(this)); // uses _store 1034Debug.Assert(Monitor.IsEntered(this)); // uses _store 1118Debug.Assert(!Monitor.IsEntered(_reader));
src\libraries\System.Private.CoreLib\src\System\Resources\RuntimeResourceSet.cs (1)
287Debug.Assert(!Monitor.IsEntered(reader));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ConditionalWeakTable.cs (2)
390Debug.Assert(Monitor.IsEntered(table._lock), "Must hold the _lock lock to construct the enumerator"); 490Debug.Assert(Monitor.IsEntered(_lock));
src\libraries\System.Private.CoreLib\src\System\SR.cs (2)
52Monitor.Enter(_lock, ref lockTaken); 114Monitor.Exit(_lock);
src\libraries\System.Private.CoreLib\src\System\Threading\ManualResetEventSlim.cs (3)
283Monitor.PulseAll(m_lock); 584if (!Monitor.Wait(m_lock, realMillisecondsTimeout)) 661Monitor.PulseAll(mre.m_lock); // awaken all waiters
src\libraries\System.Private.CoreLib\src\System\Threading\PeriodicTimer.cs (1)
258Debug.Assert(!Monitor.IsEntered(this));
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (8)
362Monitor.Enter(m_lockObjAndDisposed, ref lockTaken); 427Monitor.Exit(m_lockObjAndDisposed); 475bool waitSuccessful = Monitor.Wait(m_lockObjAndDisposed, remainingWaitMilliseconds); 665Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held"); 695Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held"); 722Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held"); 827Monitor.Pulse(m_lockObjAndDisposed); 917Monitor.PulseAll(semaphore.m_lockObjAndDisposed); // wake up all waiters.
src\libraries\System.Private.CoreLib\src\System\Threading\SpinLock.cs (1)
25/// cref="Monitor"/>, in size or due to garbage collection pressure, is overly
src\libraries\System.Private.CoreLib\src\System\Threading\SpinWait.cs (1)
54/// <see cref="Monitor"/>. For most purposes where spin waiting is required, however,
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs (1)
735Debug.Assert(Monitor.IsEntered(syncObj) == held, "The locking scheme was not correctly followed.");
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
3509Monitor.Enter(list); 3510Monitor.Exit(list);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (1)
2055Debug.Assert(Monitor.IsEntered(cachedData));
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (2)
289Debug.Assert(Monitor.IsEntered(cachedData)); 315Debug.Assert(Monitor.IsEntered(cachedData));
src\System\RuntimeType.CoreCLR.cs (4)
405Monitor.Enter(this, ref lockTaken); 469Monitor.Exit(this); 1661Monitor.Enter(s_methodInstantiationsLock, ref lockTaken); 1682Monitor.Exit(s_methodInstantiationsLock);
src\System\Threading\Monitor.CoreCLR.cs (1)
188/// Gets the number of times there was contention upon trying to take a <see cref="Monitor"/>'s lock so far.
System.Private.Uri (1)
System\Uri.cs (1)
3787Debug.Assert((_flags & Flags.Debug_LeftConstructor) == 0 || (!_syntax.IsSimple && Monitor.IsEntered(_info)));
System.Private.Windows.Core.TestUtilities (6)
BinaryFormatterInClipboardDragDropScope.cs (2)
12Monitor.Enter(typeof(BinaryFormatterInClipboardDragDropScope)); 30Monitor.Exit(typeof(BinaryFormatterInClipboardDragDropScope));
BinaryFormatterScope.cs (2)
19Monitor.Enter(typeof(BinaryFormatterScope)); 31Monitor.Exit(typeof(BinaryFormatterScope));
NrbfSerializerInClipboardDragDropScope.cs (2)
12Monitor.Enter(typeof(NrbfSerializerInClipboardDragDropScope)); 30Monitor.Exit(typeof(NrbfSerializerInClipboardDragDropScope));
System.Private.Xml (11)
System\Xml\Schema\Preprocessor.cs (3)
134Monitor.Enter(listSchema); 161Monitor.Exit(listSchema); 166Monitor.Exit(listSchema); //Release locks on all schema objects
System\Xml\Schema\XmlSchemaSet.cs (8)
312Monitor.TryEnter(InternalSyncObject, ref thisLockObtained); 315Monitor.TryEnter(schemas.InternalSyncObject, ref schemasLockObtained); 322Monitor.Exit(InternalSyncObject); //Give up this lock and try both again 368Monitor.Exit(InternalSyncObject); 372Monitor.Exit(schemas.InternalSyncObject); 516Monitor.Enter(currentSchema); 562Monitor.Exit(currentSchema); 567Monitor.Exit(currentSchema);
System.Reflection.MetadataLoadContext (2)
System\Reflection\TypeLoading\Modules\GetTypeCoreCache.cs (2)
31Monitor.Enter(_lock); 43Monitor.Exit(_lock);
System.Resources.Extensions (11)
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (10)
341Debug.Assert(Monitor.IsEntered(this)); // uses _store 542Debug.Assert(Monitor.IsEntered(this)); // uses _store 562Debug.Assert(Monitor.IsEntered(this)); // uses _store 624Debug.Assert(Monitor.IsEntered(this)); // uses _store 644Debug.Assert(Monitor.IsEntered(this)); // uses _store 782Debug.Assert(!Monitor.IsEntered(this)); // only called during init 805Debug.Assert(!Monitor.IsEntered(this)); // only called during init 994Debug.Assert(Monitor.IsEntered(this)); // uses _store 1034Debug.Assert(Monitor.IsEntered(this)); // uses _store 1118Debug.Assert(!Monitor.IsEntered(_reader));
src\libraries\System.Private.CoreLib\src\System\Resources\RuntimeResourceSet.cs (1)
287Debug.Assert(!Monitor.IsEntered(reader));
System.Security.Cryptography (3)
System\Security\Cryptography\X509Certificates\OpenSslCachedSystemStoreProvider.cs (3)
115Monitor.IsEntered(s_recheckStopwatch), 145Monitor.IsEntered(s_recheckStopwatch), 310Monitor.IsEntered(s_recheckStopwatch),
System.ServiceModel.NetNamedPipe (6)
System\ServiceModel\Channels\PipeConnection.cs (6)
387Fx.Assert(Monitor.IsEntered(_readLock), "_readLock must be entered"); 393Fx.Assert(Monitor.IsEntered(_writeLock), "_writeLock must be entered"); 399Fx.Assert(Monitor.IsEntered(_readLock), "_readLock must be entered"); 405Fx.Assert(Monitor.IsEntered(_writeLock), "_writeLock must be entered"); 508Fx.Assert(Monitor.IsEntered(_readLock), "_readLock must be entered"); 530Fx.Assert(Monitor.IsEntered(_writeLock), "_writeLock must be entered");
System.Text.Json (1)
System\Text\Json\Serialization\Metadata\JsonTypeInfo.cs (1)
741Debug.Assert(Monitor.IsEntered(Options.CacheContext), "Configure called directly, use EnsureConfigured which synchronizes access to this method");
System.Text.RegularExpressions (4)
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (4)
129Debug.Assert(Monitor.IsEntered(this)); 143Debug.Assert(Monitor.IsEntered(this)); 167Debug.Assert(Monitor.IsEntered(this)); 295Debug.Assert(Monitor.IsEntered(this));
System.Threading (1)
artifacts\obj\System.Threading\Debug\net10.0\System.Threading.Forwards.cs (1)
18[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Threading.Monitor))]
System.Threading.Channels (13)
System\Threading\Channels\BoundedChannel.cs (10)
246Debug.Assert(Monitor.IsEntered(parent.SyncObj)); 364Monitor.Enter(parent.SyncObj, ref releaseLock); 425Monitor.Exit(parent.SyncObj); 440Monitor.Exit(parent.SyncObj); 451Monitor.Exit(parent.SyncObj); 539Monitor.Enter(parent.SyncObj, ref releaseLock); 616Monitor.Exit(parent.SyncObj); 631Monitor.Exit(parent.SyncObj); 642Monitor.Exit(parent.SyncObj); 679Debug.Assert(Monitor.IsEntered(SyncObj), "Invariants can only be validated while holding the lock.");
System\Threading\Channels\UnboundedChannel.cs (1)
330Debug.Assert(Monitor.IsEntered(SyncObj), "Invariants can only be validated while holding the lock.");
System\Threading\Channels\UnboundedPriorityChannel.cs (2)
141Debug.Assert(Monitor.IsEntered(parent.SyncObj)); 335Debug.Assert(Monitor.IsEntered(SyncObj), "Invariants can only be validated while holding the lock.");
System.Threading.Tasks.Dataflow (2)
Internal\Common.cs (1)
49Debug.Assert(Monitor.IsEntered(syncObj) == held, "The locking scheme was not correctly followed.");
Internal\SourceCore.cs (1)
748if (outgoingLockKnownAcquired || Monitor.IsEntered(OutgoingLock))
System.Transactions.Local (69)
System\Transactions\CommittableTransaction.cs (2)
109} while (Monitor.Wait(_internalTransaction)); 178} while (Monitor.Wait(_internalTransaction));
System\Transactions\DurableEnlistmentState.cs (4)
93Monitor.Exit(enlistment.Transaction); 114Monitor.Enter(enlistment.Transaction); 144Monitor.Exit(enlistment.Transaction); 170Monitor.Enter(enlistment.Transaction);
System\Transactions\EnlistmentState.cs (14)
115Monitor.Exit(enlistment.SyncRoot); 123Monitor.Enter(enlistment.SyncRoot); 129Monitor.Exit(enlistment.SyncRoot); 137Monitor.Enter(enlistment.SyncRoot); 143Monitor.Exit(enlistment.SyncRoot); 151Monitor.Enter(enlistment.SyncRoot); 157Monitor.Exit(enlistment.SyncRoot); 165Monitor.Enter(enlistment.SyncRoot); 171Monitor.Exit(enlistment.SyncRoot); 179Monitor.Enter(enlistment.SyncRoot); 185Monitor.Exit(enlistment.SyncRoot); 193Monitor.Enter(enlistment.SyncRoot); 199Monitor.Exit(enlistment.SyncRoot); 207Monitor.Enter(enlistment.SyncRoot);
System\Transactions\InternalTransaction.cs (2)
352Monitor.Exit(this); // Don't hold a lock calling user code. 360Monitor.Enter(this);
System\Transactions\TransactionState.cs (27)
1348Monitor.Pulse(tx); 1672Monitor.Exit(tx); 1685Monitor.Enter(tx); 1701Monitor.Exit(tx); 1714Monitor.Enter(tx); 1732Monitor.Exit(tx); 1755Monitor.Enter(tx); 1773Monitor.Exit(tx); 1796Monitor.Enter(tx); 1809Monitor.Exit(tx); 1816Monitor.Enter(tx); 1899Monitor.Exit(tx); 1913Monitor.Enter(tx); 1942Monitor.Exit(tx); 1956Monitor.Enter(tx); 2538Monitor.Exit(tx); 2547Monitor.Enter(tx); 2646Monitor.Exit(tx); 2655Monitor.Enter(tx); 2763Monitor.Exit(tx); 2772Monitor.Enter(tx); 2805Monitor.Exit(tx); 2814Monitor.Enter(tx); 4614Monitor.Exit(tx); 4629Monitor.Enter(tx); 4649Monitor.Exit(tx); 4664Monitor.Enter(tx);
System\Transactions\TransactionTable.cs (2)
79Monitor.Enter(SyncRoot); 115Monitor.Exit(SyncRoot);
System\Transactions\VolatileEnlistmentMultiplexing.cs (8)
88Monitor.TryEnter(demux._transaction, 250, ref tookLock); 109Monitor.Exit(demux._transaction); 127Monitor.TryEnter(demux._transaction, 250, ref tookLock); 148Monitor.Exit(demux._transaction); 166Monitor.TryEnter(demux._transaction, 250, ref tookLock); 187Monitor.Exit(demux._transaction); 205Monitor.TryEnter(demux._transaction, 250, ref tookLock); 226Monitor.Exit(demux._transaction);
System\Transactions\VolatileEnlistmentState.cs (10)
138Monitor.Exit(enlistment.Transaction); 152Monitor.Enter(enlistment.Transaction); 219Monitor.Exit(enlistment.Transaction); 234Monitor.Enter(enlistment.Transaction); 363Monitor.Exit(enlistment.Transaction); 377Monitor.Enter(enlistment.Transaction); 406Monitor.Exit(enlistment.Transaction); 421Monitor.Enter(enlistment.Transaction); 440Monitor.Exit(enlistment.Transaction); 455Monitor.Enter(enlistment.Transaction);
System.Windows.Forms.TestUtilities (14)
AnchorLayoutV2Scope.cs (2)
20Monitor.Enter(typeof(AnchorLayoutV2Scope)); 32Monitor.Exit(typeof(AnchorLayoutV2Scope));
ApplyParentFontToMenusScope.cs (2)
20Monitor.Enter(typeof(ApplyParentFontToMenusScope)); 32Monitor.Exit(typeof(ApplyParentFontToMenusScope));
DataGridViewUIAStartRowCountAtZeroScope.cs (2)
19Monitor.Enter(typeof(DataGridViewUIAStartRowCountAtZeroScope)); 31Monitor.Exit(typeof(DataGridViewUIAStartRowCountAtZeroScope));
NoClientNotificationsScope.cs (2)
20Monitor.Enter(typeof(NoClientNotificationsScope)); 32Monitor.Exit(typeof(NoClientNotificationsScope));
ScaleTopLevelFormMinMaxSizeForDpiScope.cs (2)
20Monitor.Enter(typeof(ScaleTopLevelFormMinMaxSizeForDpiScope)); 32Monitor.Exit(typeof(ScaleTopLevelFormMinMaxSizeForDpiScope));
ServicePointManagerCheckCrlScope.cs (2)
20Monitor.Enter(typeof(ServicePointManagerCheckCrlScope)); 32Monitor.Exit(typeof(ServicePointManagerCheckCrlScope));
TreeNodeCollectionAddRangeRespectsSortOrderScope.cs (2)
20Monitor.Enter(typeof(TreeNodeCollectionAddRangeRespectsSortOrderScope)); 32Monitor.Exit(typeof(TreeNodeCollectionAddRangeRespectsSortOrderScope));