Skip to content

Commit 971092e

Browse files
committed
Fixes assertion error, when destroing ctx while creating a socket from a different thread: ./src/mutex.hpp:123
1 parent fa2f2c6 commit 971092e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

zmq.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,14 @@ namespace zmq
372372

373373
inline ~context_t () ZMQ_NOTHROW
374374
{
375-
close();
375+
int rc = zmq_ctx_destroy (ptr);
376+
ZMQ_ASSERT (rc == 0);
376377
}
377378

378379
inline void close() ZMQ_NOTHROW
379380
{
380-
if (ptr == NULL)
381-
return;
382-
int rc = zmq_ctx_destroy (ptr);
381+
int rc = zmq_ctx_shutdown (ptr);
383382
ZMQ_ASSERT (rc == 0);
384-
ptr = NULL;
385383
}
386384

387385
// Be careful with this, it's probably only useful for

0 commit comments

Comments
 (0)