conditionVar.I 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file conditionVar.I
  10. * @author drose
  11. * @date 2002-08-09
  12. */
  13. /**
  14. * You must pass in a Mutex to the condition variable constructor. This mutex
  15. * may be shared by other condition variables, if desired. It is the caller's
  16. * responsibility to ensure the Mutex object does not destruct during the
  17. * lifetime of the condition variable.
  18. */
  19. INLINE ConditionVar::
  20. ConditionVar(Mutex &mutex) :
  21. #ifdef DEBUG_THREADS
  22. ConditionVarDebug(mutex)
  23. #else
  24. ConditionVarDirect(mutex)
  25. #endif // DEBUG_THREADS
  26. {
  27. }
  28. /**
  29. * Returns the mutex associated with this condition variable.
  30. */
  31. INLINE Mutex &ConditionVar::
  32. get_mutex() const {
  33. #ifdef DEBUG_THREADS
  34. return (Mutex &)ConditionVarDebug::get_mutex();
  35. #else
  36. return (Mutex &)ConditionVarDirect::get_mutex();
  37. #endif // DEBUG_THREADS
  38. }