cppzmq icon indicating copy to clipboard operation
cppzmq copied to clipboard

Question

Open wanggujin opened this issue 4 years ago • 3 comments

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 ?

wanggujin avatar Feb 02 '21 08:02 wanggujin

even if i called shutdown() function before close()

wanggujin avatar Feb 02 '21 08:02 wanggujin

I found a possible reason: there is no receiver or the receiver exited. But how can i solve this problem ?

wanggujin avatar Feb 02 '21 08:02 wanggujin

You must close or destruct all sockets before closing the context. Otherwise it will block.

gummif avatar Feb 02 '21 11:02 gummif