Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/sys/windows/Condition.h
Go to the documentation of this file.
00001 #ifndef _sys_windows_Condition_h
00002 #define _sys_windows_Condition_h
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
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  

Qpid C++ API Reference
Generated on Thu Aug 23 2012 for Qpid C++ Client API by doxygen 1.7.5