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.

159 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. dpclock.c
  5. Abstract:
  6. This module contains the implementation for threaded DPC spin lock
  7. acquire and release functions.
  8. Author:
  9. David N. Cutler (davec) 4-Dec-2001
  10. Environment:
  11. Kernel mode only.
  12. --*/
  13. #include "ki.h"
  14. KIRQL
  15. FASTCALL
  16. KeAcquireSpinLockForDpc (
  17. IN PKSPIN_LOCK SpinLock
  18. )
  19. /*++
  20. Routine Description:
  21. This function conditionally raises IRQL to DISPATCH_LEVEL and acquires
  22. the specified spin lock.
  23. N.B. The conditional IRQL raise is predicated on whether a thread DPC
  24. is enabled.
  25. Arguments:
  26. SpinLock - Supplies the address of a spin lock.
  27. Return Value:
  28. If the IRQL is raised, then the previous IRQL is returned. Otherwise, zero
  29. is returned.
  30. --*/
  31. {
  32. return KiAcquireSpinLockForDpc(SpinLock);
  33. }
  34. VOID
  35. FASTCALL
  36. KeReleaseSpinLockForDpc (
  37. IN PKSPIN_LOCK SpinLock,
  38. IN KIRQL OldIrql
  39. )
  40. /*++
  41. Routine Description:
  42. This function releases the specified spin lock and conditionally lowers
  43. IRQL to its previous value.
  44. N.B. The conditional IRQL raise is predicated on whether a thread DPC
  45. is enabled.
  46. Arguments:
  47. SpinLock - Supplies the address of a spin lock.
  48. OldIrql - Supplies the previous IRQL.
  49. Return Value:
  50. None.
  51. --*/
  52. {
  53. KiReleaseSpinLockForDpc(SpinLock, OldIrql);
  54. return;
  55. }
  56. VOID
  57. FASTCALL
  58. KeAcquireInStackQueuedSpinLockForDpc (
  59. IN PKSPIN_LOCK SpinLock,
  60. IN PKLOCK_QUEUE_HANDLE LockHandle
  61. )
  62. /*++
  63. Routine Description:
  64. This function conditionally raises IRQL to DISPATCH_LEVEL and acquires
  65. the specified in-stack spin lock.
  66. N.B. The conditional IRQL raise is predicated on whether a thread DPC
  67. is enabled.
  68. Arguments:
  69. SpinLock - Supplies the address of a spin lock.
  70. LockHandle - Supplies the address of a lock handle.
  71. Return Value:
  72. None.
  73. --*/
  74. {
  75. KiAcquireInStackQueuedSpinLockForDpc(SpinLock, LockHandle);
  76. return;
  77. }
  78. VOID
  79. FASTCALL
  80. KeReleaseInStackQueuedSpinLockForDpc (
  81. IN PKLOCK_QUEUE_HANDLE LockHandle
  82. )
  83. /*++
  84. Routine Description:
  85. This function releases the specified in-stack spin lock and conditionally
  86. lowers IRQL to its previous value.
  87. N.B. The conditional IRQL raise is predicated on whether a thread DPC
  88. is enabled.
  89. Arguments:
  90. LockHandle - Supplies the address of a lock handle.
  91. Return Value:
  92. None.
  93. --*/
  94. {
  95. KiReleaseInStackQueuedSpinLockForDpc(LockHandle);
  96. return;
  97. }