Panda3D
|
00001 // Filename: conditionVarPosixImpl.h 00002 // Created by: drose (10Feb06) 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 CONDITIONVARPOSIXIMPL_H 00016 #define CONDITIONVARPOSIXIMPL_H 00017 00018 #include "pandabase.h" 00019 #include "selectThreadImpl.h" 00020 00021 #ifdef HAVE_POSIX_THREADS 00022 00023 #include "mutexPosixImpl.h" 00024 #include "pnotify.h" 00025 #include "config_pipeline.h" 00026 00027 #include <pthread.h> 00028 00029 class MutexPosixImpl; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : ConditionVarPosixImpl 00033 // Description : Uses Posix threads to implement a conditionVar. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA_PIPELINE ConditionVarPosixImpl { 00036 public: 00037 INLINE ConditionVarPosixImpl(MutexPosixImpl &mutex); 00038 INLINE ~ConditionVarPosixImpl(); 00039 00040 INLINE void wait(); 00041 void wait(double timeout); 00042 INLINE void notify(); 00043 INLINE void notify_all(); 00044 00045 private: 00046 MutexPosixImpl &_mutex; 00047 pthread_cond_t _cvar; 00048 }; 00049 00050 #include "conditionVarPosixImpl.I" 00051 00052 #endif // HAVE_POSIX_THREADS 00053 00054 #endif