diff options
| author | Alan Conway <aconway@apache.org> | 2007-04-03 21:18:17 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-04-03 21:18:17 +0000 |
| commit | 7043d22d1943263840eb6cefdb7c6449eeab5a14 (patch) | |
| tree | 63b97e5d150783c5e21e937a31ecf32eb15f4094 /qpid/cpp/src/client/IncomingMessage.h | |
| parent | cb99865516ce0a55698b66031599956ae97e982a (diff) | |
| download | qpid-python-7043d22d1943263840eb6cefdb7c6449eeab5a14.tar.gz | |
Moved BasicMessage::WaitableDestination to IncomingMessage::WaitableDestination so it can be shared by Basic and Message implementations.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@525282 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/client/IncomingMessage.h')
| -rw-r--r-- | qpid/cpp/src/client/IncomingMessage.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/qpid/cpp/src/client/IncomingMessage.h b/qpid/cpp/src/client/IncomingMessage.h index b01bd3eedc..bc650dfbe1 100644 --- a/qpid/cpp/src/client/IncomingMessage.h +++ b/qpid/cpp/src/client/IncomingMessage.h @@ -21,10 +21,11 @@ * under the License. * */ -#include "../sys/Mutex.h" +#include "../sys/Monitor.h" #include <map> +#include <queue> #include <vector> - +#include <boost/variant.hpp> namespace qpid { namespace client { @@ -61,6 +62,27 @@ class IncomingMessage { }; + /** A destination that a thread can wait on till a message arrives. */ + class WaitableDestination : public Destination + { + public: + WaitableDestination(); + void message(const Message& msg); + void empty(); + /** Wait till message() or empty() is called. True for message() */ + bool wait(Message& msgOut); + void shutdown(); + + private: + struct Empty {}; + typedef boost::variant<Message,Empty> Item; + sys::Monitor monitor; + std::queue<Item> queue; + bool shutdownFlag; + }; + + + /** Add a reference. Throws if already open. */ void openReference(const std::string& name); |
