Panda3D

conditionVar.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 conditionVar.h
10 * @author drose
11 * @date 2002-08-09
12 */
13
14 #ifndef CONDITIONVAR_H
15 #define CONDITIONVAR_H
16
17 #include "pandabase.h"
18 #include "conditionVarDebug.h"
19 #include "conditionVarDirect.h"
20
21 /**
22 * A condition variable, usually used to communicate information about
23 * changing state to a thread that is waiting for something to happen. A
24 * condition variable can be used to "wake up" a thread when some arbitrary
25 * condition has changed.
26 *
27 * The ConditionVar class does not support the full semantics of POSIX
28 * condition variables. In particular, it does not support the broadcast or
29 * notify_all function. See ConditionVarFull for a more complete (but
30 * possibly more expensive) API.
31 *
32 * A condition variable is associated with a single mutex, and several
33 * condition variables may share the same mutex.
34 *
35 * This class inherits its implementation either from ConditionVarDebug or
36 * ConditionVarDirect, depending on the definition of DEBUG_THREADS.
37 */
38 #ifdef DEBUG_THREADS
39 class EXPCL_PANDA_PIPELINE ConditionVar : public ConditionVarDebug
40 #else
41 class EXPCL_PANDA_PIPELINE ConditionVar : public ConditionVarDirect
42 #endif // DEBUG_THREADS
43 {
44 PUBLISHED:
45 INLINE explicit ConditionVar(Mutex &mutex);
46 ConditionVar(const ConditionVar &copy) = delete;
47 ~ConditionVar() = default;
48
49 ConditionVar &operator = (const ConditionVar &copy) = delete;
50
51 // These methods are inherited from the base class.
52 //INLINE void wait();
53 //INLINE void notify();
54
55 // The notify_all() method is specifically *not* provided by ConditionVar.
56 // Use ConditionVarFull if you need to call this method.
57 void notify_all() = delete;
58
59 INLINE Mutex &get_mutex() const;
60 };
61
62 #include "conditionVar.I"
63
64 #endif
ConditionVarDirect
A condition variable, usually used to communicate information about changing state to a thread that i...
Definition: conditionVarDirect.h:32
ConditionVar
A condition variable, usually used to communicate information about changing state to a thread that i...
Definition: conditionVar.h:43
ConditionVar::get_mutex
Mutex & get_mutex() const
Returns the mutex associated with this condition variable.
Definition: conditionVar.I:34
ConditionVar::ConditionVar
ConditionVar(Mutex &mutex)
You must pass in a Mutex to the condition variable constructor.
Definition: conditionVar.I:21
Mutex
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:40
conditionVarDebug.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
conditionVarDirect.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
conditionVar.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.