static void rd_thread_destroy (rd_thread_t *rdt) { assert(rdt->rdt_state != RD_THREAD_S_RUNNING); if (rdt->rdt_name) free(rdt->rdt_name); rd_fifoq_destroy(&rdt->rdt_eventq); free(rdt); }
void rb_http_handler_destroy(struct rb_http_handler_s *rb_http_handler, char *err, size_t errsize) { assert(rb_http_handler != NULL); (void)err; (void)errsize; int i = 0; ATOMIC_OP(sub, fetch, &rb_http_handler->thread_running, 1); rd_fifoq_destroy(&rb_http_handler->rfq_reports); if (rb_http_handler->options->url != NULL) { free(rb_http_handler->options->url); } if (rb_http_handler->options->mode == NORMAL_MODE) { pthread_join(rb_http_handler->threads[0]->p_thread, NULL); curl_multi_cleanup(rb_http_handler->multi_handle); free(rb_http_handler->threads[0]); } else { for (i = 0; i < rb_http_handler->options->connections; i++) { pthread_join(rb_http_handler->threads[i]->p_thread, NULL); curl_easy_cleanup(rb_http_handler->threads[i]->easy_handle); free(rb_http_handler->threads[i]); } } free(rb_http_handler->options); free(rb_http_handler); curl_global_cleanup(); }