00001 #ifndef _sys_windows_Condition_h
00002 #define _sys_windows_Condition_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "qpid/sys/Mutex.h"
00026 #include "qpid/sys/Time.h"
00027
00028 #include <time.h>
00029 #include <boost/noncopyable.hpp>
00030 #include <boost/thread/condition.hpp>
00031 #include <boost/thread/thread_time.hpp>
00032 #include <windows.h>
00033
00034 namespace qpid {
00035 namespace sys {
00036
00040 class Condition : private boost::noncopyable
00041 {
00042 public:
00043 inline Condition();
00044 inline ~Condition();
00045 inline void wait(Mutex&);
00046 inline bool wait(Mutex&, const AbsTime& absoluteTime);
00047 inline void notify();
00048 inline void notifyAll();
00049
00050 private:
00051 boost::condition_variable_any condition;
00052 };
00053
00054 Condition::Condition() {
00055 }
00056
00057 Condition::~Condition() {
00058 }
00059
00060 void Condition::wait(Mutex& mutex) {
00061 condition.wait(mutex.mutex);
00062 }
00063
00064 bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){
00065 return condition.timed_wait(mutex.mutex, absoluteTime.timepoint);
00066 }
00067
00068 void Condition::notify(){
00069 condition.notify_one();
00070 }
00071
00072 void Condition::notifyAll(){
00073 condition.notify_all();
00074 }
00075
00076 }}
00077 #endif