cppzmq
cppzmq copied to clipboard
Question
My code always hang in close function: void close() ZMQ_NOTHROW { if (ptr == ZMQ_NULLPTR) return;
int rc;
do {
rc = zmq_ctx_destroy(ptr);
} while (rc == -1 && errno == EINTR);
ZMQ_ASSERT(rc == 0);
ptr = ZMQ_NULLPTR;
}
why there is a loop ?
even if i called shutdown() function before close()
I found a possible reason: there is no receiver or the receiver exited. But how can i solve this problem ?
You must close or destruct all sockets before closing the context. Otherwise it will block.