Panda3D
 All Classes Functions Variables Enumerations
conditionVarFullDebug.h
1 // Filename: conditionVarFullDebug.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 CONDITIONVARFULLDEBUG_H
16 #define CONDITIONVARFULLDEBUG_H
17 
18 #include "pandabase.h"
19 #include "pmutex.h"
20 #include "conditionVarImpl.h"
21 
22 #ifdef DEBUG_THREADS
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : ConditionVarFullDebug
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 ConditionVarFullDebug {
37 public:
38  ConditionVarFullDebug(MutexDebug &mutex);
39  virtual ~ConditionVarFullDebug();
40 private:
41  INLINE ConditionVarFullDebug(const ConditionVarFullDebug &copy);
42  INLINE void operator = (const ConditionVarFullDebug &copy);
43 
44 PUBLISHED:
45  INLINE MutexDebug &get_mutex() const;
46 
47  BLOCKING void wait();
48  BLOCKING void wait(double timeout);
49  void notify();
50  void notify_all();
51  virtual void output(ostream &out) const;
52 
53 private:
54  MutexDebug &_mutex;
55  ConditionVarFullImpl _impl;
56 };
57 
58 INLINE ostream &
59 operator << (ostream &out, const ConditionVarFullDebug &cv) {
60  cv.output(out);
61  return out;
62 }
63 
64 #include "conditionVarFullDebug.I"
65 
66 #endif // DEBUG_THREADS
67 
68 #endif