Пример #1
0
        internal void Untrack(TrackedLock lck)
        {
            bool temp;

            if (!Locks.TryRemove(lck, out temp))
            {
                throw new ThreadStateException();
            }

            OrderedDictionary <Wait, bool> waits;

            if (Waits.TryGet(lck, out waits))
            {
                lock (waits) {
                    foreach (var w in waits)
                    {
                        w.Key.Dispose();
                    }

                    waits.Clear();
                }

                if (!Waits.TryRemove(lck))
                {
                    throw new ThreadStateException();
                }
            }
        }
Пример #2
0
        internal void Untrack(WeakTrackedLockReference weakLock)
        {
            var lck = (TrackedLock)weakLock.Target;

            if (lck == null)
            {
                return;
            }

            bool temp;

            if (!Locks.TryRemove(weakLock, out temp))
            {
                throw new ThreadStateException();
            }

            OrderedDictionary <Wait, bool> waits;

            if (Waits.TryGet(lck, out waits))
            {
                lock (waits) {
                    foreach (var w in waits)
                    {
                        w.Key.Dispose();
                    }

                    waits.Clear();
                }

                if (!Waits.TryRemove(lck))
                {
                    throw new ThreadStateException();
                }
            }
        }
Пример #3
0
        private void Remove(TypeDefinition type)
        {
            var identifier = new TypeIdentifier(type);
            var typeName   = type.FullName;

            TypeProxies.Remove(identifier);
            TypeInformation.TryRemove(identifier);
            DirectProxiesByTypeName.Remove(typeName);
            ProxiesByName.TryRemove(typeName);

            foreach (var nt in type.NestedTypes)
            {
                Remove(nt);
            }
        }
Пример #4
0
        public void Remove(params AssemblyDefinition[] assemblies)
        {
            lock (Assemblies)
                foreach (var assembly in assemblies)
                {
                    Assemblies.Remove(assembly);
                    ProxyAssemblyNames.Remove(assembly.FullName);

                    foreach (var module in assembly.Modules)
                    {
                        ModuleInformation.TryRemove(module.FullyQualifiedName);

                        foreach (var type in module.Types)
                        {
                            Remove(type);
                        }
                    }
                }
        }