Panda3D
conditionVarDirect.h
Go to the documentation of this file.
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 conditionVarDirect.h
10  * @author drose
11  * @date 2006-02-13
12  */
13 
14 #ifndef CONDITIONVARDIRECT_H
15 #define CONDITIONVARDIRECT_H
16 
17 #include "pandabase.h"
18 #include "mutexDirect.h"
19 #include "conditionVarImpl.h"
20 
21 #ifndef DEBUG_THREADS
22 
23 /**
24  * A condition variable, usually used to communicate information about
25  * changing state to a thread that is waiting for something to happen. A
26  * condition variable can be used to "wake up" a thread when some arbitrary
27  * condition has changed.
28  *
29  * A condition variable is associated with a single mutex, and several
30  * condition variables may share the same mutex.
31  */
32 class EXPCL_PANDA_PIPELINE ConditionVarDirect {
33 public:
34  INLINE explicit ConditionVarDirect(MutexDirect &mutex);
35  ConditionVarDirect(const ConditionVarDirect &copy) = delete;
36  ~ConditionVarDirect() = default;
37 
38  ConditionVarDirect &operator = (const ConditionVarDirect &copy) = delete;
39 
40 PUBLISHED:
41  INLINE MutexDirect &get_mutex() const;
42 
43  BLOCKING INLINE void wait();
44  BLOCKING INLINE void wait(double timeout);
45  INLINE void notify();
46  void output(std::ostream &out) const;
47 
48 private:
49  MutexDirect &_mutex;
50  ConditionVarImpl _impl;
51 };
52 
53 INLINE std::ostream &
54 operator << (std::ostream &out, const ConditionVarDirect &cv) {
55  cv.output(out);
56  return out;
57 }
58 
59 #include "conditionVarDirect.I"
60 
61 #endif // !DEBUG_THREADS
62 
63 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void output(std::ostream &out) const
This method is declared virtual in ConditionVarDebug, but non-virtual in ConditionVarDirect.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A condition variable, usually used to communicate information about changing state to a thread that i...
This class implements a standard mutex by making direct calls to the underlying implementation layer.
Definition: mutexDirect.h:30