AssertHasLock() public method

Throw an exception if the lock is not held by the calling thread.
The lock is not currently held by the calling thread.
public AssertHasLock ( ) : void
return void
コード例 #1
0
        private ImmutableArray <Registry <TEventHandler> > GetRegistries_NoLock <TEventHandler>(string eventName)
            where TEventHandler : class
        {
            _guard.AssertHasLock();
            if (_eventNameToRegistries.TryGetValue(eventName, out var registries))
            {
                return((ImmutableArray <Registry <TEventHandler> >)registries);
            }

            return(ImmutableArray.Create <Registry <TEventHandler> >());
        }
コード例 #2
0
ファイル: EventMap.cs プロジェクト: yicong/roslyn
        private ImmutableArray <TEventHandler> GetEvents_NoLock <TEventHandler>(string eventName)
        {
            _guard.AssertHasLock();

            object handlers;

            if (_eventNameToHandlers.TryGetValue(eventName, out handlers))
            {
                return((ImmutableArray <TEventHandler>)handlers);
            }

            return(ImmutableArray.Create <TEventHandler>());
        }