Panda3D
|
00001 // Filename: conditionVar.I 00002 // Created by: drose (09Aug02) 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ConditionVar::Constructor 00018 // Access: Published 00019 // Description: You must pass in a Mutex to the condition variable 00020 // constructor. This mutex may be shared by other 00021 // condition variables, if desired. It is the caller's 00022 // responsibility to ensure the Mutex object does not 00023 // destruct during the lifetime of the condition 00024 // variable. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE ConditionVar:: 00027 ConditionVar(Mutex &mutex) : 00028 #ifdef DEBUG_THREADS 00029 ConditionVarDebug(mutex) 00030 #else 00031 ConditionVarDirect(mutex) 00032 #endif // DEBUG_THREADS 00033 { 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: ConditionVar::Destructor 00038 // Access: Published 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 INLINE ConditionVar:: 00042 ~ConditionVar() { 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: ConditionVar::Copy Constructor 00047 // Access: Private 00048 // Description: Do not attempt to copy condition variables. 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE ConditionVar:: 00051 ConditionVar(const ConditionVar ©) : 00052 #ifdef DEBUG_THREADS 00053 ConditionVarDebug(copy.get_mutex()) 00054 #else 00055 ConditionVarDirect(copy.get_mutex()) 00056 #endif // DEBUG_THREADS 00057 { 00058 nassertv(false); 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: ConditionVar::Copy Assignment Operator 00063 // Access: Private 00064 // Description: Do not attempt to copy condition variables. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE void ConditionVar:: 00067 operator = (const ConditionVar ©) { 00068 nassertv(false); 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: ConditionVar::notify_all 00073 // Access: Private 00074 // Description: The notify_all() method is specifically *not* 00075 // provided by ConditionVar. Use ConditionVarFull if 00076 // you need to call this method. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE void ConditionVar:: 00079 notify_all() { 00080 nassertv(false); 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: ConditionVar::get_mutex 00085 // Access: Published 00086 // Description: Returns the mutex associated with this condition 00087 // variable. 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE Mutex &ConditionVar:: 00090 get_mutex() const { 00091 #ifdef DEBUG_THREADS 00092 return (Mutex &)ConditionVarDebug::get_mutex(); 00093 #else 00094 return (Mutex &)ConditionVarDirect::get_mutex(); 00095 #endif // DEBUG_THREADS 00096 }