Panda3D
 All Classes Functions Variables Enumerations
conditionVarPosixImpl.h
1 // Filename: conditionVarPosixImpl.h
2 // Created by: drose (10Feb06)
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 CONDITIONVARPOSIXIMPL_H
16 #define CONDITIONVARPOSIXIMPL_H
17 
18 #include "pandabase.h"
19 #include "selectThreadImpl.h"
20 
21 #ifdef HAVE_POSIX_THREADS
22 
23 #include "mutexPosixImpl.h"
24 #include "pnotify.h"
25 #include "config_pipeline.h"
26 
27 #include <pthread.h>
28 
29 class MutexPosixImpl;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : ConditionVarPosixImpl
33 // Description : Uses Posix threads to implement a conditionVar.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_PIPELINE ConditionVarPosixImpl {
36 public:
37  INLINE ConditionVarPosixImpl(MutexPosixImpl &mutex);
38  INLINE ~ConditionVarPosixImpl();
39 
40  INLINE void wait();
41  void wait(double timeout);
42  INLINE void notify();
43  INLINE void notify_all();
44 
45 private:
46  MutexPosixImpl &_mutex;
47  pthread_cond_t _cvar;
48 };
49 
50 #include "conditionVarPosixImpl.I"
51 
52 #endif // HAVE_POSIX_THREADS
53 
54 #endif