diff options
| author | Gordon Sim <gsim@apache.org> | 2009-10-08 19:04:05 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2009-10-08 19:04:05 +0000 |
| commit | 13742274b99bbc308d1a65b2c337d11e0a9880ba (patch) | |
| tree | 1698f3f081d0ec25ae97eebb7af6d9d0f46bcb44 /qpid/cpp/src | |
| parent | 827edcd4c3f3989db484061e83ed739574860157 (diff) | |
| download | qpid-python-13742274b99bbc308d1a65b2c337d11e0a9880ba.tar.gz | |
QPID-2132: further fix from Ken Giusti.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@823279 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp | 16 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/agent/ManagementAgentImpl.h | 5 |
2 files changed, 15 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp index a537127119..f9f39316e2 100644 --- a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp +++ b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp @@ -89,11 +89,12 @@ ManagementAgentImpl::ManagementAgentImpl() : ManagementAgentImpl::~ManagementAgentImpl() { - // shutdown the connection thread + // shutdown & cleanup all threads connThreadBody.close(); - connThread.join(); + pubThreadBody.close(); - // @todo need to shutdown pubThread? + connThread.join(); + pubThread.join(); // Release the memory associated with stored management objects. { @@ -907,8 +908,13 @@ bool ManagementAgentImpl::ConnectionThread::isSleeping() const void ManagementAgentImpl::PublishThread::run() { - while (true) { + uint16_t totalSleep; + + while (!shutdown) { agent.periodicProcessing(); - ::sleep(agent.getInterval()); + totalSleep = 0; + while (totalSleep++ < agent.getInterval() && !shutdown) { + ::sleep(1); + } } } diff --git a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h index 63366823fe..a876496e98 100644 --- a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h +++ b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h @@ -194,8 +194,11 @@ class ManagementAgentImpl : public ManagementAgent, public client::MessageListen { ManagementAgentImpl& agent; void run(); + bool shutdown; public: - PublishThread(ManagementAgentImpl& _agent) : agent(_agent) {} + PublishThread(ManagementAgentImpl& _agent) : + agent(_agent), shutdown(false) {} + void close() { shutdown = true; } }; ConnectionThread connThreadBody; |
