Panda3D
conditionVarSimpleImpl.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 conditionVarSimpleImpl.h
10  * @author drose
11  * @date 2007-06-19
12  */
13 
14 #ifndef CONDITIONVARSIMPLEIMPL_H
15 #define CONDITIONVARSIMPLEIMPL_H
16 
17 #include "pandabase.h"
18 #include "selectThreadImpl.h"
19 
20 #ifdef THREAD_SIMPLE_IMPL
21 
22 #include "blockerSimple.h"
23 #include "mutexTrueImpl.h"
24 
25 /**
26  * Implements a simple condition variable using simulated user-space threads.
27  */
28 class EXPCL_PANDA_PIPELINE ConditionVarSimpleImpl : public BlockerSimple {
29 public:
30  INLINE ConditionVarSimpleImpl(MutexTrueImpl &mutex);
31  INLINE ~ConditionVarSimpleImpl();
32 
33  void wait();
34  void wait(double timeout);
35  INLINE void notify();
36  INLINE void notify_all();
37 
38 private:
39  void do_notify();
40  void do_notify_all();
41 
42  MutexTrueImpl &_mutex;
43 };
44 
45 #include "conditionVarSimpleImpl.I"
46 
47 #endif // THREAD_SIMPLE_IMPL
48 
49 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...