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>());
        }