Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. priolist.cxx
  5. Abstract:
  6. Contains prioritized, serialized list class implementation
  7. Contents:
  8. CPriorityList::Insert
  9. CPriorityList::Remove
  10. Author:
  11. Richard L Firth (rfirth) 03-May-1997
  12. Notes:
  13. Properly, the CPriorityList class should extend a CSerializedList class, but
  14. we don't currently have one, just a serialized list type (common\serialst.cxx).
  15. WARNING: Code in this module makes assumptions about the contents of a
  16. SERIALIZED_LIST
  17. Revision History:
  18. 03-May-1997 rfirth
  19. Created
  20. --*/
  21. #include <wininetp.h>
  22. //
  23. // class methods
  24. //
  25. VOID
  26. CPriorityList::Insert(
  27. IN CPriorityListEntry * pEntry
  28. )
  29. /*++
  30. Routine Description:
  31. Insert prioritized list entry into prioritized, serialized list
  32. Arguments:
  33. pEntry - pointer to prioritized list entry to add
  34. Return Value:
  35. None.
  36. --*/
  37. {
  38. DEBUG_ENTER((DBG_UTIL,
  39. None,
  40. "CPriorityList::Insert",
  41. "{%#x} %#x",
  42. this,
  43. pEntry
  44. ));
  45. Acquire();
  46. INET_ASSERT(!IsOnSerializedList(&m_List, pEntry->List()));
  47. INET_ASSERT(pEntry->Next() == NULL);
  48. INET_ASSERT(pEntry->Prev() == NULL);
  49. CPriorityListEntry * pCur;
  50. for (pCur = (CPriorityListEntry *)m_List.List.Flink;
  51. pCur != (CPriorityListEntry *)&m_List.List.Flink;
  52. pCur = (CPriorityListEntry *)pCur->Next()) {
  53. if (pCur->GetPriority() < pEntry->GetPriority()) {
  54. break;
  55. }
  56. }
  57. InsertHeadList(pCur->Prev(), pEntry->List());
  58. ++m_List.ElementCount;
  59. Release();
  60. DEBUG_LEAVE(0);
  61. }
  62. VOID
  63. CPriorityList::Remove(
  64. IN CPriorityListEntry * pEntry
  65. )
  66. /*++
  67. Routine Description:
  68. Remove entry from prioritized serialized list
  69. Arguments:
  70. pEntry - address of entry to remove
  71. Return Value:
  72. None.
  73. --*/
  74. {
  75. DEBUG_ENTER((DBG_UTIL,
  76. None,
  77. "CPriorityList::Remove",
  78. "{%#x} %#x",
  79. this,
  80. pEntry
  81. ));
  82. Acquire();
  83. INET_ASSERT(IsOnSerializedList(&m_List, pEntry->List()));
  84. pEntry->Remove();
  85. --m_List.ElementCount;
  86. Release();
  87. DEBUG_LEAVE(0);
  88. }