Panda3D

conditionVarWin32Impl.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 conditionVarWin32Impl.h
10 * @author drose
11 * @date 2006-02-07
12 */
13
14 #ifndef CONDITIONVARWIN32IMPL_H
15 #define CONDITIONVARWIN32IMPL_H
16
17 #include "pandabase.h"
18 #include "selectThreadImpl.h"
19
20 #if defined(WIN32_VC)
21
22 #include "mutexWin32Impl.h"
23 #include "pnotify.h"
24
25 class MutexWin32Impl;
26
27 /**
28 * Uses Windows native calls to implement a conditionVar.
29 *
30 * The Windows native synchronization primitives don't actually implement a
31 * full POSIX-style condition variable, but the Event primitive does a fair
32 * job if we disallow notify_all() (POSIX broadcast). See
33 * ConditionVarFullWin32Impl for a full implementation that includes
34 * notify_all(). This class is much simpler than that full implementation, so
35 * we can avoid the overhead required to support broadcast.
36 */
37 class EXPCL_PANDA_PIPELINE ConditionVarWin32Impl {
38 public:
39 INLINE ConditionVarWin32Impl(MutexWin32Impl &mutex);
40 INLINE ~ConditionVarWin32Impl();
41
42 INLINE void wait();
43 INLINE void wait(double timeout);
44 INLINE void notify();
45
46 private:
47 CRITICAL_SECTION *_external_mutex;
48 HANDLE _event_signal;
49 };
50
51 #include "conditionVarWin32Impl.I"
52
53 #endif // WIN32_VC
54
55 #endif
conditionVarWin32Impl.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexWin32Impl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnotify.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
selectThreadImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.