Panda3D
conditionVar.I
1 // Filename: conditionVar.I
2 // Created by: drose (09Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ConditionVar::Constructor
18 // Access: Published
19 // Description: You must pass in a Mutex to the condition variable
20 // constructor. This mutex may be shared by other
21 // condition variables, if desired. It is the caller's
22 // responsibility to ensure the Mutex object does not
23 // destruct during the lifetime of the condition
24 // variable.
25 ////////////////////////////////////////////////////////////////////
26 INLINE ConditionVar::
28 #ifdef DEBUG_THREADS
29  ConditionVarDebug(mutex)
30 #else
31  ConditionVarDirect(mutex)
32 #endif // DEBUG_THREADS
33 {
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: ConditionVar::Destructor
38 // Access: Published
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 INLINE ConditionVar::
42 ~ConditionVar() {
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: ConditionVar::Copy Constructor
47 // Access: Private
48 // Description: Do not attempt to copy condition variables.
49 ////////////////////////////////////////////////////////////////////
50 INLINE ConditionVar::
51 ConditionVar(const ConditionVar &copy) :
52 #ifdef DEBUG_THREADS
53  ConditionVarDebug(copy.get_mutex())
54 #else
56 #endif // DEBUG_THREADS
57 {
58  nassertv(false);
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: ConditionVar::Copy Assignment Operator
63 // Access: Private
64 // Description: Do not attempt to copy condition variables.
65 ////////////////////////////////////////////////////////////////////
66 INLINE void ConditionVar::
67 operator = (const ConditionVar &copy) {
68  nassertv(false);
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: ConditionVar::notify_all
73 // Access: Private
74 // Description: The notify_all() method is specifically *not*
75 // provided by ConditionVar. Use ConditionVarFull if
76 // you need to call this method.
77 ////////////////////////////////////////////////////////////////////
78 INLINE void ConditionVar::
79 notify_all() {
80  nassertv(false);
81 }
82 
83 ////////////////////////////////////////////////////////////////////
84 // Function: ConditionVar::get_mutex
85 // Access: Published
86 // Description: Returns the mutex associated with this condition
87 // variable.
88 ////////////////////////////////////////////////////////////////////
89 INLINE Mutex &ConditionVar::
90 get_mutex() const {
91 #ifdef DEBUG_THREADS
92  return (Mutex &)ConditionVarDebug::get_mutex();
93 #else
95 #endif // DEBUG_THREADS
96 }
ConditionVarDirect(MutexDirect &mutex)
You must pass in a Mutex to the condition variable constructor.
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:44
A condition variable, usually used to communicate information about changing state to a thread that i...
Definition: conditionVar.h:47
ConditionVar(Mutex &mutex)
You must pass in a Mutex to the condition variable constructor.
Definition: conditionVar.I:27
MutexDirect & get_mutex() const
Returns the mutex associated with this condition variable.
A condition variable, usually used to communicate information about changing state to a thread that i...
Mutex & get_mutex() const
Returns the mutex associated with this condition variable.
Definition: conditionVar.I:90