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

            foreach (KeyValuePair <Int64, ThreadStackNode> pair in r_threadStackNodes)
            {
                Int64           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 <Int64, ThreadStack> pair in threadStacks)
            {
                Int64           newId = pair.Key;
                ThreadStackNode threadStackNode;
                if (!r_threadStackNodes.TryGetValue(newId, out threadStackNode))
                {
                    threadStackNode = new ThreadStackNode(r_manager, r_processNode, pair.Value);
                    r_threadStackNodes.Add(newId, threadStackNode);
                }
            }
        }
Example #2
0
        private void RefreshChildren(Dictionary<Int64, ThreadStack> threadStacks)
        {
            List<Int64> threadsNoLonger = new List<Int64>();

            foreach (KeyValuePair<Int64, ThreadStackNode> pair in r_threadStackNodes)
            {
                Int64 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<Int64, ThreadStack> pair in threadStacks)
            {
                Int64 newId = pair.Key;
                ThreadStackNode threadStackNode;
                if (!r_threadStackNodes.TryGetValue(newId, out threadStackNode))
                {
                    threadStackNode = new ThreadStackNode(r_manager, r_processNode, pair.Value);
                    r_threadStackNodes.Add(newId, threadStackNode);
                }
            }
        }