Panda3D
conditionVarFull.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file conditionVarFull.h
10  * @author drose
11  * @date 2006-08-28
12  */
13 
14 #ifndef CONDITIONVARFULL_H
15 #define CONDITIONVARFULL_H
16 
17 #include "pandabase.h"
18 #include "conditionVarFullDebug.h"
19 #include "conditionVarFullDirect.h"
20 
21 /**
22  * This class implements a condition variable; see ConditionVar for a brief
23  * introduction to this class. The ConditionVarFull class provides a more
24  * complete implementation than ConditionVar; in particular, it provides the
25  * notify_all() method, which is guaranteed to wake up all threads currently
26  * waiting on the condition (whereas notify() is guaranteed to wake up at
27  * least one thread, but may or may not wake up all of them).
28  *
29  * This class exists because on certain platforms (e.g. Win32), implementing
30  * notify_all() requires more overhead, so you should use ConditionVar for
31  * cases when you do not require the notify_all() semantics.
32  *
33  * There are still some minor semantics that POSIX condition variables provide
34  * which this implementation does not. For instance, it is required (not
35  * optional) that the caller of notify() or notify_all() is holding the
36  * condition variable's mutex before the call.
37  *
38  * This class inherits its implementation either from ConditionVarFullDebug or
39  * ConditionVarFullDirect, depending on the definition of DEBUG_THREADS.
40  */
41 #ifdef DEBUG_THREADS
42 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDebug
43 #else
44 class EXPCL_PANDA_PIPELINE ConditionVarFull : public ConditionVarFullDirect
45 #endif // DEBUG_THREADS
46 {
47 PUBLISHED:
48  INLINE explicit ConditionVarFull(Mutex &mutex);
49  ConditionVarFull(const ConditionVarFull &copy) = delete;
50  ~ConditionVarFull() = default;
51 
52  ConditionVarFull &operator = (const ConditionVarFull &copy) = delete;
53 
54  INLINE Mutex &get_mutex() const;
55 };
56 
57 #include "conditionVarFull.I"
58 
59 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:38
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Mutex & get_mutex() const
Returns the mutex associated with this condition variable.
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.