Exemple #1
0
mama_status
mamaDispatcher_destroy (mamaDispatcher dispatcher)
{
    mamaDispatcherImpl* impl = (mamaDispatcherImpl*)dispatcher;

    if (!impl)
        return MAMA_STATUS_NULL_ARG;

    /* Set dispatching atomic so dispatcher thread is ready to exit */
    wInterlocked_set(0, &impl->mIsDispatching);

    if (impl->mQueue)
    {
        mamaQueue_stopDispatch (impl->mQueue);
    }

    /* Wait for the thread to return. */
    wthread_join (impl->mThread, NULL);
    wInterlocked_destroy (&impl->mIsDispatching);

    /* Destroy the thread handle. */
    wthread_destroy(impl->mThread);

    impl->mQueue->mDispatcher = NULL;
    impl->mThread = 0; 
    free (impl);
    return MAMA_STATUS_OK;
}
Exemple #2
0
mama_status
qpidBridge_stop (mamaQueue defaultEventQueue)
{
    if (NULL == defaultEventQueue)
    {
      mama_log (MAMA_LOG_LEVEL_FINER,
                "qpidBridge_stop(): defaultEventQueue is NULL");
      return MAMA_STATUS_NULL_ARG;
    }

    return mamaQueue_stopDispatch (defaultEventQueue);;
}
mama_status
mamaDispatcher_destroy (mamaDispatcher dispatcher)
{
    mamaDispatcherImpl* impl = (mamaDispatcherImpl*)dispatcher;

    if (!impl)
        return MAMA_STATUS_NULL_ARG;

    if( impl->mQueue && impl->mIsDispatching )
    {
        impl->mIsDispatching = 0;
        mamaQueue_stopDispatch (impl->mQueue);
    }

    impl->mDestroy = 1;

    /* Wait for the thread to return. */
    wthread_join (impl->mThread, NULL);

    impl->mQueue->mDispatcher = NULL;
    free (impl);
    return MAMA_STATUS_OK;
}