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