Panda3D

Loading...
Searching...
No Matches
conditionVarFullDebug.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 conditionVarFullDebug.h
10 * @author drose
11 * @date 2006-08-28
12 */
13
14#ifndef CONDITIONVARFULLDEBUG_H
15#define CONDITIONVARFULLDEBUG_H
16
17#include "pandabase.h"
18#include "pmutex.h"
19#include "conditionVarImpl.h"
20
21#ifdef DEBUG_THREADS
22
23/**
24 * A condition variable, usually used to communicate information about
25 * changing state to a thread that is waiting for something to happen. A
26 * condition variable can be used to "wake up" a thread when some arbitrary
27 * condition has changed.
28 *
29 * A condition variable is associated with a single mutex, and several
30 * condition variables may share the same mutex.
31 */
32 class EXPCL_PANDA_PIPELINE ConditionVarFullDebug {
33 public:
34 explicit ConditionVarFullDebug(MutexDebug &mutex);
35 ConditionVarFullDebug(const ConditionVarFullDebug &copy) = delete;
36 virtual ~ConditionVarFullDebug();
37
38 ConditionVarFullDebug &operator = (const ConditionVarFullDebug &copy) = delete;
39
40PUBLISHED:
41 INLINE MutexDebug &get_mutex() const;
42
43 BLOCKING void wait();
44 BLOCKING void wait(double timeout);
45 void notify();
46 void notify_all();
47 virtual void output(std::ostream &out) const;
48
49 private:
50 MutexDebug &_mutex;
51 ConditionVarFullImpl _impl;
52};
53
54INLINE std::ostream &
55operator << (std::ostream &out, const ConditionVarFullDebug &cv) {
56 cv.output(out);
57 return out;
58}
59
60#include "conditionVarFullDebug.I"
61
62#endif // DEBUG_THREADS
63
64#endif
conditionVarFullDebug.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
conditionVarImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pmutex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.