private void RefreshWaitedObjects(ThreadStack threadStack) { List <WaitBlock> newWaitedNodes = new List <WaitBlock>(threadStack.WaitBlocks.Values); int countOld = r_waitedNodes.Count; int countNew = newWaitedNodes.Count; int to = countNew; if (countNew < countOld) { for (int i = countNew; i < countOld; ++i) { r_ownedNodes[countNew].Remove(); r_ownedNodes.RemoveAt(countNew); } } else if (countOld < countNew) { to = countOld; int index = countOld; for (int i = 0; i < (countNew - countOld); ++i) { WaitBlock objectAddress = newWaitedNodes[index]; ThreadStackWaitedOnNode waitedOnNode = new ThreadStackWaitedOnNode(r_manager, r_threadStackNode, index, objectAddress); r_waitedNodes.Add(waitedOnNode); ++index; } } for (int i = 0; i < to; ++i) { r_waitedNodes[i].Refresh(newWaitedNodes[i]); } }
private void RefreshWaitedObjects(ThreadStack threadStack) { List<WaitBlock> newWaitedNodes = new List<WaitBlock>(threadStack.WaitBlocks.Values); int countOld = r_waitedNodes.Count; int countNew = newWaitedNodes.Count; int to = countNew; if (countNew < countOld) { for (int i = countNew; i < countOld; ++i) { r_ownedNodes[countNew].Remove(); r_ownedNodes.RemoveAt(countNew); } } else if (countOld < countNew) { to = countOld; int index = countOld; for (int i = 0; i < (countNew - countOld); ++i) { WaitBlock objectAddress = newWaitedNodes[index]; ThreadStackWaitedOnNode waitedOnNode = new ThreadStackWaitedOnNode(r_manager, r_threadStackNode, index, objectAddress); r_waitedNodes.Add(waitedOnNode); ++index; } } for (int i = 0; i < to; ++i) { r_waitedNodes[i].Refresh(newWaitedNodes[i]); } }