Panda3D
 All Classes Functions Variables Enumerations
conditionVarFull.h
1 // Filename: conditionVarFull.h
2 // Created by: drose (28Aug06)
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 #ifndef CONDITIONVARFULL_H
16 #define CONDITIONVARFULL_H
17 
18 #include "pandabase.h"
19 #include "conditionVarFullDebug.h"
20 #include "conditionVarFullDirect.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : ConditionVarFull
24 // Description : This class implements a condition variable; see
25 // ConditionVar for a brief introduction to this class.
26 // The ConditionVarFull class provides a more complete
27 // implementation than ConditionVar; in particular, it
28 // provides the notify_all() method, which is guaranteed
29 // to wake up all threads currently waiting on the
30 // condition (whereas notify() is guaranteed to wake up
31 // at least one thread, but may or may not wake up all
32 // of them).
33 //
34 // This class exists because on certain platforms
35 // (e.g. Win32), implementing notify_all() requires more
36 // overhead, so you should use ConditionVar for cases
37 // when you do not require the notify_all() semantics.
38 //
39 // There are still some minor semantics that POSIX
40 // condition variables provide which this implementation
41 // does not. For instance, it is required (not
42 // optional) that the caller of notify() or notify_all()
43 // is holding the condition variable's mutex before the
44 // call.
45 //
46 // This class inherits its implementation either from
47 // ConditionVarFullDebug or ConditionVarFullDirect,
48 // depending on the definition of DEBUG_THREADS.
49 ////////////////////////////////////////////////////////////////////
50 #ifdef DEBUG_THREADS
51 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDebug
52 #else
53 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDirect
54 #endif // DEBUG_THREADS
55 {
56 PUBLISHED:
57  INLINE ConditionVarFull(Mutex &mutex);
58  INLINE ~ConditionVarFull();
59 private:
60  INLINE ConditionVarFull(const ConditionVarFull &copy);
61  INLINE void operator = (const ConditionVarFull &copy);
62 
63 PUBLISHED:
64  INLINE Mutex &get_mutex() const;
65 };
66 
67 #include "conditionVarFull.I"
68 
69 #endif
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:44
ConditionVarFull(Mutex &mutex)
You must pass in a Mutex to the condition variable constructor.
A condition variable, usually used to communicate information about changing state to a thread that i...
This class implements a condition variable; see ConditionVar for a brief introduction to this class...
Mutex & get_mutex() const
Returns the mutex associated with this condition variable.