Panda3D
conditionVarFullDirect.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 conditionVarFullDirect.h
10  * @author drose
11  * @date 2006-08-28
12  */
13 
14 #ifndef CONDITIONVARFULLDIRECT_H
15 #define CONDITIONVARFULLDIRECT_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 ConditionVarFullDirect {
33 public:
34  INLINE explicit ConditionVarFullDirect(MutexDirect &mutex);
35  ConditionVarFullDirect(const ConditionVarFullDirect &copy) = delete;
36  ~ConditionVarFullDirect() = default;
37 
38  ConditionVarFullDirect &operator = (const ConditionVarFullDirect &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  INLINE void notify_all();
47  void output(std::ostream &out) const;
48 
49 private:
50  MutexDirect &_mutex;
51  ConditionVarFullImpl _impl;
52 };
53 
54 INLINE std::ostream &
55 operator << (std::ostream &out, const ConditionVarFullDirect &cv) {
56  cv.output(out);
57  return out;
58 }
59 
60 #include "conditionVarFullDirect.I"
61 
62 #endif // !DEBUG_THREADS
63 
64 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void output(std::ostream &out) const
This method is declared virtual in ConditionVarFullDebug, but non-virtual in ConditionVarFullDirect.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A condition variable, usually used to communicate information about changing state to a thread that i...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class implements a standard mutex by making direct calls to the underlying implementation layer.
Definition: mutexDirect.h:30
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.