00001 // Filename: conditionVarFull.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 CONDITIONVARFULL_H 00016 #define CONDITIONVARFULL_H 00017 00018 #include "pandabase.h" 00019 #include "conditionVarFullDebug.h" 00020 #include "conditionVarFullDirect.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : ConditionVarFull 00024 // Description : This class implements a condition variable; see 00025 // ConditionVar for a brief introduction to this class. 00026 // The ConditionVarFull class provides a more complete 00027 // implementation than ConditionVar; in particular, it 00028 // provides the notify_all() method, which is guaranteed 00029 // to wake up all threads currently waiting on the 00030 // condition (whereas notify() is guaranteed to wake up 00031 // at least one thread, but may or may not wake up all 00032 // of them). 00033 // 00034 // This class exists because on certain platforms 00035 // (e.g. Win32), implementing notify_all() requires more 00036 // overhead, so you should use ConditionVar for cases 00037 // when you do not require the notify_all() semantics. 00038 // 00039 // There are still some minor semantics that POSIX 00040 // condition variables provide which this implementation 00041 // does not. For instance, it is required (not 00042 // optional) that the caller of notify() or notify_all() 00043 // is holding the condition variable's mutex before the 00044 // call. 00045 // 00046 // This class inherits its implementation either from 00047 // ConditionVarFullDebug or ConditionVarFullDirect, 00048 // depending on the definition of DEBUG_THREADS. 00049 //////////////////////////////////////////////////////////////////// 00050 #ifdef DEBUG_THREADS 00051 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDebug 00052 #else 00053 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDirect 00054 #endif // DEBUG_THREADS 00055 { 00056 PUBLISHED: 00057 INLINE ConditionVarFull(Mutex &mutex); 00058 INLINE ~ConditionVarFull(); 00059 private: 00060 INLINE ConditionVarFull(const ConditionVarFull ©); 00061 INLINE void operator = (const ConditionVarFull ©); 00062 00063 PUBLISHED: 00064 INLINE Mutex &get_mutex() const; 00065 }; 00066 00067 #include "conditionVarFull.I" 00068 00069 #endif