Fixes assertion error, when destroing ctx while creating a socket from a different thread: ./src/mutex.hpp:123

This commit is contained in:
Urs Keller 2015-10-02 16:32:36 +02:00
parent fa2f2c67a7
commit 971092e472

View File

@ -372,16 +372,14 @@ namespace zmq
inline ~context_t () ZMQ_NOTHROW inline ~context_t () ZMQ_NOTHROW
{ {
close(); int rc = zmq_ctx_destroy (ptr);
ZMQ_ASSERT (rc == 0);
} }
inline void close() ZMQ_NOTHROW inline void close() ZMQ_NOTHROW
{ {
if (ptr == NULL) int rc = zmq_ctx_shutdown (ptr);
return;
int rc = zmq_ctx_destroy (ptr);
ZMQ_ASSERT (rc == 0); ZMQ_ASSERT (rc == 0);
ptr = NULL;
} }
// Be careful with this, it's probably only useful for // Be careful with this, it's probably only useful for