Panda3D

conditionVarSimpleImpl.h

00001 // Filename: conditionVarSimpleImpl.h
00002 // Created by:  drose (19Jun07)
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 CONDITIONVARSIMPLEIMPL_H
00016 #define CONDITIONVARSIMPLEIMPL_H
00017 
00018 #include "pandabase.h"
00019 #include "selectThreadImpl.h"
00020 
00021 #ifdef THREAD_SIMPLE_IMPL
00022 
00023 #include "blockerSimple.h"
00024 #include "mutexTrueImpl.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : ConditionVarSimpleImpl
00028 // Description : Implements a simple condition variable using
00029 //               simulated user-space threads.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDA_PIPELINE ConditionVarSimpleImpl : public BlockerSimple {
00032 public:
00033   INLINE ConditionVarSimpleImpl(MutexTrueImpl &mutex);
00034   INLINE ~ConditionVarSimpleImpl();
00035 
00036   void wait();
00037   void wait(double timeout);
00038   INLINE void notify();
00039   INLINE void notify_all();
00040 
00041 private:
00042   void do_notify();
00043   void do_notify_all();
00044 
00045   MutexTrueImpl &_mutex;
00046 };
00047 
00048 #include "conditionVarSimpleImpl.I"
00049 
00050 #endif  // THREAD_SIMPLE_IMPL
00051 
00052 #endif
 All Classes Functions Variables Enumerations