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 | 88a3f9073c06478fe5065f537acb3162f0651d89 (patch) | |
tree | 5d2dbdc91d35f8b84271ae2f9b4e74be8b39ac86 /cpp/src | |
parent | 347506a906e8dec3871ed6ac6ea343ea103f267f (diff) | |
download | qpid-python-88a3f9073c06478fe5065f537acb3162f0651d89.tar.gz |
QPID-2132: further fix from Ken Giusti.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@823279 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/agent/ManagementAgentImpl.cpp | 16 | ||||
-rw-r--r-- | cpp/src/qpid/agent/ManagementAgentImpl.h | 5 |
2 files changed, 15 insertions, 6 deletions
diff --git a/cpp/src/qpid/agent/ManagementAgentImpl.cpp b/cpp/src/qpid/agent/ManagementAgentImpl.cpp index a537127119..f9f39316e2 100644 --- a/cpp/src/qpid/agent/ManagementAgentImpl.cpp +++ b/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/cpp/src/qpid/agent/ManagementAgentImpl.h b/cpp/src/qpid/agent/ManagementAgentImpl.h index 63366823fe..a876496e98 100644 --- a/cpp/src/qpid/agent/ManagementAgentImpl.h +++ b/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; |