Panda3D
|
00001 // Filename: conditionVarDebug.h 00002 // Created by: drose (13Feb06) 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 CONDITIONVARDEBUG_H 00016 #define CONDITIONVARDEBUG_H 00017 00018 #include "pandabase.h" 00019 #include "pmutex.h" 00020 #include "conditionVarImpl.h" 00021 00022 #ifdef DEBUG_THREADS 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : ConditionVarDebug 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 ConditionVarDebug { 00037 public: 00038 ConditionVarDebug(MutexDebug &mutex); 00039 virtual ~ConditionVarDebug(); 00040 private: 00041 INLINE ConditionVarDebug(const ConditionVarDebug ©); 00042 INLINE void operator = (const ConditionVarDebug ©); 00043 00044 PUBLISHED: 00045 INLINE MutexDebug &get_mutex() const; 00046 00047 void wait(); 00048 void wait(double timeout); 00049 void notify(); 00050 virtual void output(ostream &out) const; 00051 00052 private: 00053 MutexDebug &_mutex; 00054 ConditionVarImpl _impl; 00055 }; 00056 00057 INLINE ostream & 00058 operator << (ostream &out, const ConditionVarDebug &cv) { 00059 cv.output(out); 00060 return out; 00061 } 00062 00063 #include "conditionVarDebug.I" 00064 00065 #endif // DEBUG_THREADS 00066 00067 #endif