Panda3D
|
00001 // Filename: conditionVarFullDebug.h 00002 // Created by: drose (28Aug06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CONDITIONVARFULLDEBUG_H 00016 #define CONDITIONVARFULLDEBUG_H 00017 00018 #include "pandabase.h" 00019 #include "pmutex.h" 00020 #include "conditionVarImpl.h" 00021 00022 #ifdef DEBUG_THREADS 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : ConditionVarFullDebug 00026 // Description : A condition variable, usually used to communicate 00027 // information about changing state to a thread that is 00028 // waiting for something to happen. A condition 00029 // variable can be used to "wake up" a thread when some 00030 // arbitrary condition has changed. 00031 // 00032 // A condition variable is associated with a single 00033 // mutex, and several condition variables may share the 00034 // same mutex. 00035 //////////////////////////////////////////////////////////////////// 00036 class EXPCL_PANDA_PIPELINE ConditionVarFullDebug { 00037 public: 00038 ConditionVarFullDebug(MutexDebug &mutex); 00039 virtual ~ConditionVarFullDebug(); 00040 private: 00041 INLINE ConditionVarFullDebug(const ConditionVarFullDebug ©); 00042 INLINE void operator = (const ConditionVarFullDebug ©); 00043 00044 PUBLISHED: 00045 INLINE MutexDebug &get_mutex() const; 00046 00047 void wait(); 00048 void wait(double timeout); 00049 void notify(); 00050 void notify_all(); 00051 virtual void output(ostream &out) const; 00052 00053 private: 00054 MutexDebug &_mutex; 00055 ConditionVarFullImpl _impl; 00056 }; 00057 00058 INLINE ostream & 00059 operator << (ostream &out, const ConditionVarFullDebug &cv) { 00060 cv.output(out); 00061 return out; 00062 } 00063 00064 #include "conditionVarFullDebug.I" 00065 00066 #endif // DEBUG_THREADS 00067 00068 #endif