Panda3D
 All Classes Functions Variables Enumerations
conditionVarSimpleImpl.h
1 // Filename: conditionVarSimpleImpl.h
2 // Created by: drose (19Jun07)
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 CONDITIONVARSIMPLEIMPL_H
16 #define CONDITIONVARSIMPLEIMPL_H
17 
18 #include "pandabase.h"
19 #include "selectThreadImpl.h"
20 
21 #ifdef THREAD_SIMPLE_IMPL
22 
23 #include "blockerSimple.h"
24 #include "mutexTrueImpl.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : ConditionVarSimpleImpl
28 // Description : Implements a simple condition variable using
29 // simulated user-space threads.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_PIPELINE ConditionVarSimpleImpl : public BlockerSimple {
32 public:
33  INLINE ConditionVarSimpleImpl(MutexTrueImpl &mutex);
34  INLINE ~ConditionVarSimpleImpl();
35 
36  void wait();
37  void wait(double timeout);
38  INLINE void notify();
39  INLINE void notify_all();
40 
41 private:
42  void do_notify();
43  void do_notify_all();
44 
45  MutexTrueImpl &_mutex;
46 };
47 
48 #include "conditionVarSimpleImpl.I"
49 
50 #endif // THREAD_SIMPLE_IMPL
51 
52 #endif
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...