00001 /* 00002 * Conditional.h 00003 * 00004 * Created on: 16.07.2009 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef IBRCOMMON_WAITFORCONDITIONAL_H_ 00009 #define IBRCOMMON_WAITFORCONDITIONAL_H_ 00010 00011 #include "ibrcommon/thread/Conditional.h" 00012 00013 namespace ibrcommon 00014 { 00015 class WaitForConditional : public ibrcommon::Conditional 00016 { 00017 public: 00018 WaitForConditional() {}; 00019 virtual ~WaitForConditional() {}; 00020 00021 void wait(size_t time = 0) 00022 { 00023 enter(); 00024 if (time == 0) 00025 ibrcommon::Conditional::wait(); 00026 else 00027 ibrcommon::Conditional::wait(time); 00028 leave(); 00029 } 00030 00031 void go() 00032 { 00033 enter(); 00034 ibrcommon::Conditional::signal(true); 00035 leave(); 00036 } 00037 }; 00038 } 00039 00040 #endif /* WAITFORCONDITIONAL_H_ */
1.6.3