ML Reference
MeVis/Foundation/Sources/MLUtilities/mlWaitCondition.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00005 
00010 //----------------------------------------------------------------------------------
00011 #ifndef __mlWaitCondition_H
00012 #define __mlWaitCondition_H
00013 
00014 #ifndef __mlUtilsSystem_H
00015 #include "mlUtilsSystem.h"
00016 #endif
00017 
00018 #include "mlMutex.h"
00019 
00020 ML_UTILS_START_NAMESPACE
00021 
00022 //--------------------------------------------------------------------
00025 
00041 //--------------------------------------------------------------------
00042 class WaitCondition
00043 {
00044 public:
00045   WaitCondition() {};
00046 
00047   //--------------------------------------------------------------------
00050   //--------------------------------------------------------------------
00051   void wait(Lock& lock)
00052   {
00053     _condition.wait(lock);
00054   }
00055 
00056   //--------------------------------------------------------------------
00058   //--------------------------------------------------------------------
00059   void notifyAll()
00060   {
00061     _condition.notify_all();
00062   }
00063 
00064   //--------------------------------------------------------------------
00066   //--------------------------------------------------------------------
00067   void notifyOne()
00068   {
00069     _condition.notify_one();
00070   }
00071 
00072 private:
00074   boost::condition _condition;
00075 };
00076 
00077 ML_UTILS_END_NAMESPACE
00078 
00079 #endif // __mlWaitCondition_H
00080 
00081