void reply_socket::close() { if (z_socket != NULL) { remove_from_pollset(); unregister_all_keys(); zmq_close(z_socket); z_socket = NULL; } }
void subscribe_socket::close() { if (zk_keyval != NULL) { zk_keyval->remove_callback(zk_kv_callback_id); zk_keyval = NULL; } if (z_socket != NULL) { remove_from_pollset(); zmq_close(z_socket); z_socket = NULL; } }
void async_reply_socket::close() { if (z_socket != NULL) { remove_from_pollset(); unregister_all_keys(); // kill all threads queuelock.lock(); queue_terminate = true; queuecond.notify_all(); queuelock.unlock(); for (size_t i = 0;i < threads.size(); ++i) { threads[i].thread->join(); delete threads[i].thread; zmq_close(threads[i].inproc_push_socket); } threads.clear(); zmq_close(z_socket); zmq_close(inproc_pull_socket); z_socket = NULL; } }