private void RefreshChildren(Dictionary <UInt32, ThreadStack> threadStacks)
        {
            List <UInt32> threadsNoLonger = new List <UInt32>();

            foreach (KeyValuePair <UInt32, ThreadStackNode> pair in r_threadStackNodes)
            {
                UInt32          oldId          = pair.Key;
                ThreadStackNode oldThreadStack = pair.Value;
                ThreadStack     tStack;
                if (threadStacks.TryGetValue(oldId, out tStack))
                {
                    oldThreadStack.Refresh(tStack);
                }
                else
                {
                    oldThreadStack.Remove();
                    threadsNoLonger.Add(oldId);
                }
            }

            foreach (UInt32 threadId in threadsNoLonger)
            {
                r_threadStackNodes.Remove(threadId);
            }

            foreach (KeyValuePair <UInt32, ThreadStack> pair in threadStacks)
            {
                UInt32          newId = pair.Key;
                ThreadStackNode threadStackNode;
                if (!r_threadStackNodes.TryGetValue(newId, out threadStackNode))
                {
                    threadStackNode = new ThreadStackNode(r_manager, r_appDomainNode, pair.Value);
                    r_threadStackNodes.Add(newId, threadStackNode);
                }
            }
        }
Example #2
0
        private void RefreshChildren(Dictionary<UInt32, ThreadStack> threadStacks)
        {
            List<UInt32> threadsNoLonger = new List<UInt32>();

            foreach (KeyValuePair<UInt32, ThreadStackNode> pair in r_threadStackNodes)
            {
                UInt32 oldId = pair.Key;
                ThreadStackNode oldThreadStack = pair.Value;
                ThreadStack tStack;
                if (threadStacks.TryGetValue(oldId, out tStack))
                {
                    oldThreadStack.Refresh(tStack);
                }
                else
                {
                    oldThreadStack.Remove();
                    threadsNoLonger.Add(oldId);
                }
            }

            foreach (UInt32 threadId in threadsNoLonger)
            {
                r_threadStackNodes.Remove(threadId);
            }

            foreach (KeyValuePair<UInt32, ThreadStack> pair in threadStacks)
            {
                UInt32 newId = pair.Key;
                ThreadStackNode threadStackNode;
                if (!r_threadStackNodes.TryGetValue(newId, out threadStackNode))
                {
                    threadStackNode = new ThreadStackNode(r_manager, r_appDomainNode, pair.Value);
                    r_threadStackNodes.Add(newId, threadStackNode);
                }
            }
        }