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; }
// Stop the UPAConsumer thread, which will also shut down RSSL void UPAConsumer::JoinThread(wthread_t thread) { if (0 != statsLogger_) { statsLogger_->Stop(); } t42log_info("stopping UPAConsumer thread\n"); runThread_ = false; if (0 != thread) { // And wait for the thread to exit wthread_join(thread, NULL); wthread_destroy(thread); } }