Panda3D
conditionVarDirect.h
1 // Filename: conditionVarDirect.h
2 // Created by: drose (13Feb06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CONDITIONVARDIRECT_H
16 #define CONDITIONVARDIRECT_H
17 
18 #include "pandabase.h"
19 #include "mutexDirect.h"
20 #include "conditionVarImpl.h"
21 
22 #ifndef DEBUG_THREADS
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : ConditionVarDirect
26 // Description : A condition variable, usually used to communicate
27 // information about changing state to a thread that is
28 // waiting for something to happen. A condition
29 // variable can be used to "wake up" a thread when some
30 // arbitrary condition has changed.
31 //
32 // A condition variable is associated with a single
33 // mutex, and several condition variables may share the
34 // same mutex.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDA_PIPELINE ConditionVarDirect {
37 public:
38  INLINE ConditionVarDirect(MutexDirect &mutex);
39  INLINE ~ConditionVarDirect();
40 private:
41  INLINE ConditionVarDirect(const ConditionVarDirect &copy);
42  INLINE void operator = (const ConditionVarDirect &copy);
43 
44 PUBLISHED:
45  INLINE MutexDirect &get_mutex() const;
46 
47  BLOCKING INLINE void wait();
48  BLOCKING INLINE void wait(double timeout);
49  INLINE void notify();
50  void output(ostream &out) const;
51 
52 private:
53  MutexDirect &_mutex;
54  ConditionVarImpl _impl;
55 };
56 
57 INLINE ostream &
58 operator << (ostream &out, const ConditionVarDirect &cv) {
59  cv.output(out);
60  return out;
61 }
62 
63 #include "conditionVarDirect.I"
64 
65 #endif // !DEBUG_THREADS
66 
67 #endif
void output(ostream &out) const
This method is declared virtual in ConditionVarDebug, but non-virtual in ConditionVarDirect.
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:32