[PATCH 08/50] [bridge] Timout for Stopping Internal Queue


Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

When shutting down, don't wait forever for the internal queue to stop. If the
queue does not stop within the default queue timeout
(mama.defaultqueue.timeout property), continue to shutdown. The default value
is 2000 milliseconds. This prevents hanging at shutdown if the distpach thread
is blocked.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/src/c/bridge.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mama/c_cpp/src/c/bridge.c b/mama/c_cpp/src/c/bridge.c
index 6970c8c..94c5caa 100644
--- a/mama/c_cpp/src/c/bridge.c
+++ b/mama/c_cpp/src/c/bridge.c
@@ -121,6 +121,8 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)
if (impl->mInternalEventQueue)
{

+ /* Get the queue timeout value. */
+ int defaultQueueTimeout = mamaBridgeImpl_getDefaultQueueTimeout();
if (MAMA_STATUS_OK != mamaDispatcher_destroy (impl->mInternalDispatcher))
{
mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_stopInternalEventQueue(): "
@@ -128,7 +130,8 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)
return MAMA_STATUS_NO_BRIDGE_IMPL;
}

- if (MAMA_STATUS_OK != mamaQueue_destroy (impl->mInternalEventQueue ))
+ /* Destroy the queue waiting for the appropriate time value. */
+ if (MAMA_STATUS_OK != mamaQueue_destroyTimedWait (impl->mInternalEventQueue, defaultQueueTimeout))
{
mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_stopInternalEventQueue(): "
"Could not destroy internal queue");
--
1.7.7.6

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.