diff options
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r-- | cpp/src/qpid/client/Dispatcher.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/client/Dispatcher.h | 1 | ||||
-rw-r--r-- | cpp/src/qpid/client/SubscriptionManager.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/client/SubscriptionManager.h | 5 |
4 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/qpid/client/Dispatcher.cpp b/cpp/src/qpid/client/Dispatcher.cpp index da6607fb9e..59bc265bd2 100644 --- a/cpp/src/qpid/client/Dispatcher.cpp +++ b/cpp/src/qpid/client/Dispatcher.cpp @@ -54,6 +54,11 @@ void Dispatcher::start() worker = Thread(this); } +void Dispatcher::wait() +{ + worker.join(); +} + void Dispatcher::run() { Mutex::ScopedLock l(lock); diff --git a/cpp/src/qpid/client/Dispatcher.h b/cpp/src/qpid/client/Dispatcher.h index 921c6449a3..e84f8f303d 100644 --- a/cpp/src/qpid/client/Dispatcher.h +++ b/cpp/src/qpid/client/Dispatcher.h @@ -63,6 +63,7 @@ public: Dispatcher(const Session& session, const std::string& queue = ""); void start(); + void wait(); void run(); void stop(); void setAutoStop(bool b); diff --git a/cpp/src/qpid/client/SubscriptionManager.cpp b/cpp/src/qpid/client/SubscriptionManager.cpp index 7445202ec3..c91ae178ac 100644 --- a/cpp/src/qpid/client/SubscriptionManager.cpp +++ b/cpp/src/qpid/client/SubscriptionManager.cpp @@ -92,6 +92,11 @@ void SubscriptionManager::start() dispatcher.start(); } +void SubscriptionManager::wait() +{ + dispatcher.wait(); +} + void SubscriptionManager::stop() { dispatcher.stop(); diff --git a/cpp/src/qpid/client/SubscriptionManager.h b/cpp/src/qpid/client/SubscriptionManager.h index 58d880fa83..948126e271 100644 --- a/cpp/src/qpid/client/SubscriptionManager.h +++ b/cpp/src/qpid/client/SubscriptionManager.h @@ -210,6 +210,11 @@ class SubscriptionManager : public sys::Runnable * @see start */ void start(); + + /** + * Wait for the thread started by a call to start() to complete. + */ + void wait(); /** If set true, run() will stop when all subscriptions * are cancelled. If false, run will only stop when stop() |