AUD_Lock.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*****************************************************************************
  19. ** **
  20. ** Westwood Studios Pacific. **
  21. ** **
  22. ** Confidential Information **
  23. ** Copyright (C) 2000 - All Rights Reserved **
  24. ** **
  25. ******************************************************************************
  26. ** **
  27. ** Project: Dune Emperor **
  28. ** **
  29. ** Module: <module> (<prefix>_) **
  30. ** **
  31. ** Version: $ID$ **
  32. ** **
  33. ** File name: audlock.cpp **
  34. ** **
  35. ** Created by: 04/01/95 TR **
  36. ** **
  37. ** Description: <description> **
  38. ** **
  39. *****************************************************************************/
  40. /*****************************************************************************
  41. ** Includes **
  42. *****************************************************************************/
  43. #include <wpaudio/altypes.h>
  44. #include <wpaudio/lock.h>
  45. DBG_DECLARE_TYPE ( Lock )
  46. /*****************************************************************************
  47. ** Externals **
  48. *****************************************************************************/
  49. /*****************************************************************************
  50. ** Defines **
  51. *****************************************************************************/
  52. /*****************************************************************************
  53. ** Private Types **
  54. *****************************************************************************/
  55. /*****************************************************************************
  56. ** Private Data **
  57. *****************************************************************************/
  58. /*****************************************************************************
  59. ** Public Data **
  60. *****************************************************************************/
  61. /*****************************************************************************
  62. ** Private Prototypes **
  63. *****************************************************************************/
  64. /*****************************************************************************
  65. ** Private Functions **
  66. *****************************************************************************/
  67. /*****************************************************************************
  68. ** Public Functions **
  69. *****************************************************************************/
  70. #ifdef _DEBUG
  71. /******************************************************************/
  72. /* */
  73. /* */
  74. /******************************************************************/
  75. void LockInit ( volatile Lock *lock )
  76. {
  77. DBG_ASSERT ( lock != NULL);
  78. LOCK_INIT(lock);
  79. DBG_SET_TYPE ( lock, Lock );
  80. }
  81. /******************************************************************/
  82. /* */
  83. /* */
  84. /******************************************************************/
  85. void LockAcquire ( volatile Lock *lock)
  86. {
  87. DBG_ASSERT_TYPE ( lock, Lock);
  88. DBG_ASSERT ( lock->count >= 0 );
  89. LOCK_ACQUIRE (lock);
  90. }
  91. /******************************************************************/
  92. /* */
  93. /* */
  94. /******************************************************************/
  95. void LockRelease ( volatile Lock *lock)
  96. {
  97. DBG_ASSERT_TYPE ( lock, Lock);
  98. DBG_ASSERT ( lock->count > 0 );
  99. LOCK_RELEASE(lock);
  100. }
  101. /******************************************************************/
  102. /* */
  103. /* */
  104. /******************************************************************/
  105. int Locked ( volatile Lock *lock)
  106. {
  107. DBG_ASSERT_TYPE ( lock, Lock);
  108. DBG_ASSERT ( lock->count >= 0 );
  109. return LOCKED(lock);
  110. }
  111. #endif