blockerSimple.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 blockerSimple.h
  10. * @author drose
  11. * @date 2007-06-20
  12. */
  13. #ifndef BLOCKERSIMPLE_H
  14. #define BLOCKERSIMPLE_H
  15. #include "pandabase.h"
  16. #include "selectThreadImpl.h"
  17. #ifdef THREAD_SIMPLE_IMPL
  18. #include "pnotify.h"
  19. /**
  20. * This is a base class for MutexSimpleImpl and ConditionVarSimpleImpl. It
  21. * represents a synchronization primitive that one or more threads might be
  22. * blocked on.
  23. */
  24. class EXPCL_PANDA_PIPELINE BlockerSimple {
  25. protected:
  26. constexpr BlockerSimple() = default;
  27. INLINE ~BlockerSimple();
  28. protected:
  29. enum Flags {
  30. // lock_count is only used for mutexes, not condition variables.
  31. F_lock_count = 0x3fffffff,
  32. F_has_waiters = 0x40000000,
  33. };
  34. unsigned int _flags = 0;
  35. friend class ThreadSimpleManager;
  36. };
  37. #include "blockerSimple.I"
  38. #endif // THREAD_SIMPLE_IMPL
  39. #endif