Panda3D
|
00001 // Filename: conditionVarWin32Impl.h 00002 // Created by: drose (07Feb06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CONDITIONVARWIN32IMPL_H 00016 #define CONDITIONVARWIN32IMPL_H 00017 00018 #include "pandabase.h" 00019 #include "selectThreadImpl.h" 00020 00021 #if defined(WIN32_VC) 00022 00023 #include "mutexWin32Impl.h" 00024 #include "pnotify.h" 00025 00026 class MutexWin32Impl; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : ConditionVarWin32Impl 00030 // Description : Uses Windows native calls to implement a 00031 // conditionVar. 00032 // 00033 // The Windows native synchronization primitives don't 00034 // actually implement a full POSIX-style condition 00035 // variable, but the Event primitive does a fair job if 00036 // we disallow notify_all() (POSIX broadcast). See 00037 // ConditionVarFullWin32Impl for a full implementation 00038 // that includes notify_all(). This class is much 00039 // simpler than that full implementation, so we can 00040 // avoid the overhead required to support broadcast. 00041 //////////////////////////////////////////////////////////////////// 00042 class EXPCL_PANDA_PIPELINE ConditionVarWin32Impl { 00043 public: 00044 INLINE ConditionVarWin32Impl(MutexWin32Impl &mutex); 00045 INLINE ~ConditionVarWin32Impl(); 00046 00047 INLINE void wait(); 00048 INLINE void wait(double timeout); 00049 INLINE void notify(); 00050 00051 private: 00052 CRITICAL_SECTION *_external_mutex; 00053 HANDLE _event_signal; 00054 }; 00055 00056 #include "conditionVarWin32Impl.I" 00057 00058 #endif // WIN32_VC 00059 00060 #endif