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.

97 lines
1.6 KiB

  1. /*
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. intrlckd.c
  5. Abstract:
  6. This module contains the routines that should have been in the EX package.
  7. This manipulates inter-locked operations on flags and such.
  8. Author:
  9. Jameel Hyder (microsoft!jameelh)
  10. Revision History:
  11. 5 Sep 1992 Initial Version
  12. Notes: Tab stop: 4
  13. --*/
  14. #define FILENUM FILE_INTRLCKD
  15. #include <afp.h>
  16. /*** AfpInterlockedSetDword
  17. *
  18. * Set specified bits using the spin-lock to provide an interlocked operation.
  19. */
  20. VOID FASTCALL
  21. AfpInterlockedSetDword(
  22. IN PDWORD pSrc,
  23. IN DWORD Mask,
  24. IN PAFP_SPIN_LOCK pSpinLock
  25. )
  26. {
  27. KIRQL OldIrql;
  28. ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
  29. *pSrc |= Mask;
  30. RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
  31. }
  32. /*** AfpInterlockedClearDword
  33. *
  34. * Clear specified bits using the spin-lock to provide an
  35. * interlocked operation.
  36. */
  37. VOID FASTCALL
  38. AfpInterlockedClearDword(
  39. IN PDWORD pSrc,
  40. IN DWORD Mask,
  41. IN PAFP_SPIN_LOCK pSpinLock
  42. )
  43. {
  44. KIRQL OldIrql;
  45. ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
  46. *pSrc &= ~Mask;
  47. RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
  48. }
  49. /*** AfpInterlockedSetNClearDword
  50. *
  51. * Set and Clear specified bits using the spin-lock to provide an
  52. * interlocked operation.
  53. */
  54. VOID FASTCALL
  55. AfpInterlockedSetNClearDword(
  56. IN PDWORD pSrc,
  57. IN DWORD SetMask,
  58. IN DWORD ClrMask,
  59. IN PAFP_SPIN_LOCK pSpinLock
  60. )
  61. {
  62. KIRQL OldIrql;
  63. ACQUIRE_SPIN_LOCK(pSpinLock, &OldIrql);
  64. *pSrc |= SetMask;
  65. *pSrc &= ~ClrMask;
  66. RELEASE_SPIN_LOCK(pSpinLock, OldIrql);
  67. }
  68.