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.

107 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1998 Intel Corporation
  3. Module Name:
  4. lock.c
  5. Abstract:
  6. Implements FLOCK
  7. Revision History
  8. --*/
  9. #include "lib.h"
  10. VOID
  11. InitializeLock (
  12. IN OUT FLOCK *Lock,
  13. IN EFI_TPL Priority
  14. )
  15. /*++
  16. Routine Description:
  17. Initialize a basic mutual exclusion lock. Each lock
  18. provides mutual exclusion access at it's task priority
  19. level. Since there is no-premption (at any TPL) or
  20. multiprocessor support, acquiring the lock only consists
  21. of raising to the locks TPL.
  22. Note on a debug build the lock is acquired and released
  23. to help ensure proper usage.
  24. Arguments:
  25. Lock - The FLOCK structure to initialize
  26. Priority - The task priority level of the lock
  27. Returns:
  28. An initialized F Lock structure.
  29. --*/
  30. {
  31. Lock->Tpl = Priority;
  32. Lock->OwnerTpl = 0;
  33. Lock->Lock = 0;
  34. }
  35. VOID
  36. AcquireLock (
  37. IN FLOCK *Lock
  38. )
  39. /*++
  40. Routine Description:
  41. Raising to the task priority level of the mutual exclusion
  42. lock, and then acquires ownership of the lock.
  43. Arguments:
  44. Lock - The lock to acquire
  45. Returns:
  46. Lock owned
  47. --*/
  48. {
  49. RtAcquireLock (Lock);
  50. }
  51. VOID
  52. ReleaseLock (
  53. IN FLOCK *Lock
  54. )
  55. /*++
  56. Routine Description:
  57. Releases ownership of the mutual exclusion lock, and
  58. restores the previous task priority level.
  59. Arguments:
  60. Lock - The lock to release
  61. Returns:
  62. Lock unowned
  63. --*/
  64. {
  65. RtReleaseLock (Lock);
  66. }