Panda3D
conditionVarFullDirect.h
1 // Filename: conditionVarFullDirect.h
2 // Created by: drose (28Aug06)
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 CONDITIONVARFULLDIRECT_H
16 #define CONDITIONVARFULLDIRECT_H
17 
18 #include "pandabase.h"
19 #include "mutexDirect.h"
20 #include "conditionVarImpl.h"
21 
22 #ifndef DEBUG_THREADS
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : ConditionVarFullDirect
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 ConditionVarFullDirect {
37 public:
38  INLINE ConditionVarFullDirect(MutexDirect &mutex);
39  INLINE ~ConditionVarFullDirect();
40 private:
41  INLINE ConditionVarFullDirect(const ConditionVarFullDirect &copy);
42  INLINE void operator = (const ConditionVarFullDirect &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  INLINE void notify_all();
51  void output(ostream &out) const;
52 
53 private:
54  MutexDirect &_mutex;
55  ConditionVarFullImpl _impl;
56 };
57 
58 INLINE ostream &
59 operator << (ostream &out, const ConditionVarFullDirect &cv) {
60  cv.output(out);
61  return out;
62 }
63 
64 #include "conditionVarFullDirect.I"
65 
66 #endif // !DEBUG_THREADS
67 
68 #endif
A condition variable, usually used to communicate information about changing state to a thread that i...
void output(ostream &out) const
This method is declared virtual in ConditionVarFullDebug, but non-virtual in ConditionVarFullDirect.
This class implements a standard mutex by making direct calls to the underlying implementation layer...
Definition: mutexDirect.h:32